Saturday, 1 March 2014

Working with the web table using QTP

In this post, i will explain how to work with the webtables using QTP code.

' Make sure that the web table object added to the repository
'Create an object with web table hirearchy
Set otable=Browser(".*").Page("*").WebTable("NameOfTheTable")
'Get the web table rowcnt
'msgbox rowcnt
'Get the web table column count for each row
'msgbox colcnt
'loop for rows
For i=1 to rowcnt
'loop for columns
For j=0 to colcnt-1
'get the cell data of the table
' msgbox val
If val="requiredValue" Then
' click on the link object inside the table
Set testing=otable.ChildItem(i,j+1,"Link",0)
Exit for
End If
If val="requiredValue" Then
Exit for
End If

No comments:

Post a Comment

Search This Blog

There was an error in this gadget