New Ranks & Badges For The Community!
Notice something different? The ranks and associated badges have gone "Star Fleet". See what they all mean HERE
Highlighted
Absent Member.
Absent Member.
1117 views

[UFT] WpfTable and WaitProperty with RowCount

Jump to solution

Hi,
I'm working with a WpfTable (DataGrid).

This grid takes more time to show all rows to the user, so I would use the WaitProperty property to wait for exactly time.

The Property is:
WpfWindow("myApp").WpfTable("myGrid").WaitProperty (PropertyName, PropertyValue, timeout)

If I set "RowCount" as PropertyName, what have I to set as PropertyValue?

I can't insert a condition, for example "<> 0".

Is there another property that i can check?
Thanks.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Vice Admiral Vice Admiral
Vice Admiral

Instead of using WaitProperty, which is more frequently used to check boolean values (enabled etc.), I would rather look into the possibility to loop until RowCount is bigger than 0, and break the loop when the criteria is met.

Please do also implement some sort of condition to break the loop after a certain amount of loops/it has run for X minutes. This to prevent an endless loop. 🙂

Do also wait for a couple of seconds during each run to await the rows to be displayed and also some error handling if the rows are not displayed at all.

Here is some code I put together (been a while since I worked with VBS). Not tested so take it with a huge pinch of salt:

numberOfIterations = 10

for i = 0 to numberOfIterations
	if WpfWindow("myApp").WpfTable("myGrid").GetRoProperty("RowCount") > 0 then
		msgbox "Congratulations - you found rows!"
		exit for
	end if
	wait 5
 next

 

View solution in original post

0 Likes
4 Replies
Highlighted
Vice Admiral Vice Admiral
Vice Admiral

Instead of using WaitProperty, which is more frequently used to check boolean values (enabled etc.), I would rather look into the possibility to loop until RowCount is bigger than 0, and break the loop when the criteria is met.

Please do also implement some sort of condition to break the loop after a certain amount of loops/it has run for X minutes. This to prevent an endless loop. 🙂

Do also wait for a couple of seconds during each run to await the rows to be displayed and also some error handling if the rows are not displayed at all.

Here is some code I put together (been a while since I worked with VBS). Not tested so take it with a huge pinch of salt:

numberOfIterations = 10

for i = 0 to numberOfIterations
	if WpfWindow("myApp").WpfTable("myGrid").GetRoProperty("RowCount") > 0 then
		msgbox "Congratulations - you found rows!"
		exit for
	end if
	wait 5
 next

 

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

 Thanks for your confirmation.

When I certain that the grid returns least one result I use a solution equals yours, but I use an Do Loop cycle instead of the For cycle.

Do
     wait 2
Loop While (WpfWindow("myApp").WpfTable("myGrid").GetROProperty("RowCount") = 0)

The results is the same.

0 Likes
Highlighted
Vice Admiral Vice Admiral
Vice Admiral

@felino wrote:

When I certain (...)

(..) The results is the same.


Brilliant!

You do say that you only enters the Do While-loop when you are absolutely sure that the grid returns at least one result, but I must emphasize that if you enter the Do While-loop without this certainty, your code will result in an endless loop (which is a nightmare for a test automation developer) 🙂 .

Good luck!

0 Likes
Highlighted
Absent Member.
Absent Member.

Of course, I use Do Loop only I sure that there are rows in the grid.

Thanks a lot!

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.