Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
want to change index dynamically of WebTable object
#5
Solved: 11 Years, 6 Months, 2 Weeks ago
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,

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
Reply


Messages In This Thread
RE: want to change index dynamically of WebTable object - by atanu - 05-07-2011, 01:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do you Change Run mode mid script? Caleytown 6 7,624 03-25-2021, 08:27 AM
Last Post: RB26578
  UFT issues with Outsystems dynamically generated Id/names jherron 2 1,517 03-02-2020, 09:33 PM
Last Post: Swishy70
  Unable to capture value of Webelement which is changing dynamically sheetal 9 16,568 02-16-2018, 11:01 AM
Last Post: janki_kakadia
  Unable to click on dynamically changing webelement preeti 0 1,892 04-29-2017, 08:50 PM
Last Post: preeti
  click each web link in a page using Index or other method in QTP smeijer 13 25,051 04-29-2017, 04:53 PM
Last Post: kowshik

Forum Jump:


Users browsing this thread: 1 Guest(s)