Micro Focus QTP (UFT) Forums

Full Version: webtable object help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

I have a problem getting the row count from a grid which may have few records.
My purpose is to check whether the grid has records if yes then random set any record and click ok. But when there is no record available in the grid then click on the cancel button of the grid window.
Here is the code I have written:

Code:
unitowner = mypage.WebTable("UnitOwnerGP").RowCount
'Fetches the row count

Webtable gives a wrong count - which gives total row count not the existng record count???

'msgbox unitowner

Code:
Set objChildItem2 = mypage.WebTable("UnitOwner").ChildItem(RandomNumber(2, unitowner -1),2,"WebElement",0)
objChildItem2.click

'used this object to click the element
now question is how do I get the value of an element. Is my below code valid?

Code:
If  objChildItem2.value= true Then
mypage.Image("OwnerOK").Click

else
mypage.Image("CancelOwner").Click
end if