Micro Focus QTP (UFT) Forums

Full Version: Counting no. of rows for a wbfgrid in a web based application
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I am trying to record a web based application,
1) Using QTP 9.5 on one page I am not able to select objects or record on button objects in a wbfgrid which in turn comes lower in the hierarchy of Webtables. I have used .rowcount and getcelldata methods but it does not return the number of rows.

2) Also to use Descriptive programming for webtables up in the hierarchy , they have similar properties. Is there a way to distinguish between them so as to get the count of exact webtable?

3) All buttons on a particular page have similar properties so QTP is just clicking the button based on x,y co-ordinates is there any way I can tie up a particular button with the text in front of it, so that unique button will only be selected.


My questions are little complicated, I will reply any counter questions to make the problem more clearer, thanks you for your patience
Normally, when the objects are created dynamically this problem may exist...you will be able to overcome these types of issue by using the Ordinal identifier - INDEX. Try including index property eg.
Code:
Browser("..").Page("..").Frame("..").Webbutton("html tag:=INPUT", "html id:=ok", "index:=0")
Code:
Browser("..").Page("..").Frame("..").Webbutton("html tag:=INPUT", "html id:=ok", "index:=1")
etc..
Hi MR21135,

Can we record and insert a checkpoint for the data generated in a Div based grid view in any web page.

I have tried this but didn't work...

----------------------------
Code:
Dim i,rows,total

rows=Browser("..").Page("..").WebTable("..").GetROProperty("rows")

For i=2 to rows
    if Browser("..").Page("..").WebTable("..").GetROProperty("rows").GetCellData(i,1)="value" Then
    total = total +1
    End if
    msgbox "No rows present"
    total = 0
Next

msgbox total

-----------------------------
here the WebTable is not able to recognize the gridview displayed in the page...

Thanks... Smile & waiting for reply
Hi,
You will not be able to use this statement
Code:
"Browser("..").Page("..").WebTable("..").GetROProperty("rows").GetCellData(i,1)"
to generate rowwise loop instead use INDEX.

here in this case you need to increment i value according to the rows for example if you have two columns and two rows then
the index would be

C1 C2
R1 0 1
R2 2 3

just try

Code:
Dim i,rows,total

rows=Browser("..").Page("..").WebTable("..").GetROProperty("rowcount")

For i=0 to rows Step 2
    if Browser("..").Page("..").WebTable("html tag:=TD","index:="&i).GetROProperty("innertext")="value" Then
            total = total +1
             Else
            msgbox "No rows present"
            total = 0
             End If
Next
msgbox total

one more thing you can also use
Code:
.GetCellData(i,1) instead of GetROProperty("innertext")

Hope i would have answered you.