I am using QTP 9.1 to automate test cases.The application has an UltraWinGrid and am trying to find a row using a search strig.I want to find the rowcount to loop through the rows to find out my search string.When I used rowcount property,I got a message saying this property is not supported.
Please let me know how do I go about that.
Thanks,
RamPriya
Hi Rampriya,
You can try the following to get the number of rows in the grid:
rowcount = SwfTable("...").GetNAProperty("Rows.Count")
Then to access each row:
For I = 0 TO rowcount-1
Set currentRow = SwfTable("...").GetNAProperty("Rows["+CSTR(I)+"]")
' To get a specific cell text for the current row
cellText = SwfTable("...").GetNAProperty("Rows["+CSTR(I)+"].Cells[0].Text")
Next
Hope that will help
Regards,
Ammar
How do you access the first visible row in a filtered grid?
Hi,
If you are using QTP 9.1, then I have the answer for your question.
There is a .Net SPY under tools menu.
Use that to find out the property you want to use.
If u click on the ultragrid,then it shows you what all the property it has.
I found when I clicked on my ultragrid,there was rows under which I found out the 4 rows that were there..they are called items.and they had some property called Hidden ..as you can see below in my code..
rCount = Window("Care").SwfWindow("Structured Notes Entry").SwfTable("grdSignificantEvent").RowCountset rowCollection = Window("Care").SwfWindow("Structured Notes Entry").SwfTable("grdSignificantEvent").Object.Rows
For iLoop = 0 to rCount -1 If rowCollection.item(iLoop).Hidden = False Then visibleCount = visibleCount +1 Else hiddenCount = hiddenCount +1 End IfNext
Thanks you,
Ram priya
You also want to test that the Row is not Filtered out:
For iLoop = 0 to rCount -1 If rowCollection.item(iLoop).Hidden = False AND rowCollection.item(iLoop).IsFilteredOut = FalseThen ' rowCollection.item(iLoop) reference the first filtered in and visible row in the rows collection so you can do something like:
MsgBox rowCollection.item(iLoop).Cells.item(0).Text Else hiddenCount = hiddenCount +1 End IfNext
Thank you very much.
You are the best . :)
Ram Priya