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.
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.
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.
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.
> 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).
var page = Sys.Browser().Page();
control = page.FindChild(<your control>);
if (control.contentText == <expected value>)
break; // exits the loop
} while true;