Thanks both for your reply.It helps to find out the solution.
Now I have solved this problem by two ways
1> Using regular Expression and runtime object Property(Without changing the index)
The code is like this,
2> Change the WebTable index dynamically
The code is like this,
Now I have solved this problem by two ways
1> Using regular Expression and runtime object Property(Without changing the index)
The code is like this,
Code:
Set obj = Description.Create
obj("micclass").Value = "WebTable"
obj("html tag").Value = "TABLE"
obj("inner text").Value = "Security CodeLedger Category.*"
Set objCol = Browser("Application").Page("Application").Frame("mainFrame").ChildObjects(obj)
runtimename= objCol(1).GetROProperty("name")
runtimeabs_x=objCol(1).GetROProperty("x")
Browser("Application").Page("Application").Frame("mainFrame").WebTable("Security Code").SetToProperty "name", runtimename
Browser("Application").Page("Application").Frame("mainFrame").WebTable("Security Code").SetToProperty "x", runtimeabs_x
Browser("Application").Page("Application").Frame("mainFrame").WebTable("Security Code" ).Check CheckPoint("Security Code")
2> Change the WebTable index dynamically
The code is like this,
Code:
Set obj = Description.Create
obj ("micclass").Value = "WebTable"
obj ("html tag").Value = "TABLE"
obj ("innertext").Value = "Security CodeLedger Category.*"
Set objCol = Browser ("Application").Page("Application").Frame("mainFrame").ChildObjects(obj)
If iCount <> 0 Then
Set table2use=objCol.item(iCount-1)
Else
Msgbox ( "cound not find the table")
End If
HeaderTableIndex= GetQTPTableIndex (table2use)
dataTableIndex=headerTableIndex
Browser("Application").Page("Application").Frame("mainFrame").WebTable("index:=" & dataTableIndex).Check CheckPoint("Security Code")
Function GetQTPTableIndex(TableObj)
On Error Resume Next
Set TableObj = TableObj.Object
On Error Goto 0
srcIndex = TableObj.sourceIndex
Set domDocument = TableObj.document.documentElement
Set allTables= domDocument.getElementsByTagName("TABLE")
i = 0
For each table in allTables
If table.sourceIndex = srcIndex Then
GetQTPTableIndex = i
Exit Function
End If
i = i + 1
Next
End Function