I suggest you ...

Add a set of WaitForCondition() methods (e.g. WaitForElementPresent())

A set of WaitForCondition() methods may be extremely useful. Like:
- WaitForElementPresent();
- WaitForElementNotPresent();
- WaitForElementVisible() etc.
It also might be pure WaitForCondition() which accepts a condition to wait for.

23 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Evgenij LozovanEvgenij Lozovan shared this idea  ·   ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Evgenij LozovanEvgenij Lozovan commented  · 

        Honestly, I'm not sure where it should be placed, it might be a separate WaitHelper class for example. And as far as I see in the roadmap under "Suggested Future APIs" there is " State management API" item, so it could be there (if I get that API's meaning correctly).
        As a side note, the purpose of having such methods is to deal somehow with ElementNotFound exceptions when UI Tree is not yet updated and your test is already searching for an element. Or to handle a situation when an element changes its state/property values dynamically. A straightforward solution is to use Thread.Sleep() but WaitForCondition is just more elegant and time-saving approach.

        As for method signature it might be WaitFor...(AutomationElement root, AutomationElement elementOfInterest, TreeScope treeScope, Condition condition).

      Feedback and Knowledge Base