cancel
Showing results for 
Search instead for 
Did you mean: 

Waitporperty for webControl

New Contributor

Waitporperty for webControl

Using waitProperty to verify contentText(Numeric Value) of a control on web page.

 

Once the count is increased and page is refreshed the waitporperty is not able to pick it and verify it.

 

WaitProperty,Inprogress,contentText,6,120,,

 

4 REPLIES 4
Community Hero

Re: Waitporperty for webControl

Hi,

 

Not sure what the question/problem is, but if

> the count is increased and page is refreshed

then the target object might become invalid and must be obtained a-new.

 

Correct actions sequence:

-- Click some control that triggers an action;

-- Wait for the page obtained;

-- Search for/wait until the target control appears on the page;

-- Wait until its property obtains required value.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Community Hero

Re: Waitporperty for webControl

In addition to what @AlexKaras mentions, if you have your "WaitProperty" waiting for a value (say, 10), and each time you run the test that number increases, then yes, this won't work for you.  Instead of waiting for a static value, you need to make your test "smarter".

 

We do something similar and here's how we check it.

 

1) BEFORE we execute the main part of the test, we navigate to the control and capture in a variable the value currently present.

2) We then perform the test actions.

3) Then we go back to that control and use the previously stored value to check for the new value.  We use such checks as "is greater than" or, if we know that we're expecting an increase of 1, we do a check where we wait for the property to be the previously stored value + 1.

 

 


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Contributor

Re: Waitporperty for webControl

The value being pushed is from another application and its automated. It takes time for that value to be pulled up on page, so using waitproperty to wait for it to get updated. Once it gets updated the waitproperty is not able to verify it and the script fails.

 

As per @AlexKaras - once the page is refreshed the control gets changed then how to handle this.

 

Community Hero

Re: Waitporperty for webControl

Hi,

 

> once the page is refreshed the control gets changed then how to handle this.

Get control a-new, exactly like you do for the first time.

If the page/control refreshes by timer, then you should search for control and check its value in a loop (within some timeout).
Pseudo-code:

var control;

var page = Sys.Browser().Page();

do

{

  control = page.FindChild(<your control>);

  if (control.Exists)

    if (control.contentText == <expected value>)

      break; // exits the loop

 

  Delay(1000);

} while true;

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Postings made by [Community Expert Group] members
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
February News
Top Kudoed Authors