Micro Focus QTP (UFT) Forums
How to get selected childitem in webtable? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: How to get selected childitem in webtable? (/Thread-How-to-get-selected-childitem-in-webtable)



How to get selected childitem in webtable? - rupali0205 - 02-07-2012

Hi,

In web application, webtable (wbfgrid) is displayed with 5th column containing 7 different values in non-editable boxes. QTP identifies these as 'WebElement'.
I have selected one of the values (which is highlighted in blue after selection) in each row.
Now I want to fetch the selected value. But I am not finding any distinguishing property between selected and non-selected value.

Following snippet of code is tried to fetch the webelement value

Code:
Set myWebTable = browser("title:=.*").page("title:=.*").wbfgrid("html id:=.*Grid")
a = myWebTable.ChildItem(2, 5, "WebElement", 0).getroproperty("innertext")
Please help

Thanks
Rupali


RE: How to get selected childitem in webtable? - rupali0205 - 02-08-2012

Just to add more info on this...
e.g.
Following values are displayed in webelement boxes of column no. 5
val1 val2 val3 val4

Assume val2 is selected before and when I save the changes and come back to this page, val2 box is highlighted.

If i execute the below code, I will get the below output.

Code:
Set myWebTable = browser("title:=.*").page("title:=.*").wbfgrid("html id:=.*Grid")
For index = 2 to 8
a = myWebTable.ChildItem(2, 5, "WebElement", index).getroproperty("innertext")
print a
Next

o/p:
val1
val2
val3
val4

I want to retrieve the value which is already selected i.e. val2. How will I get that?