Add a set of WaitForCondition() methods (e.g. WaitForElementPresent())
A set of WaitForCondition() methods may be extremely useful. Like:
- WaitForElementVisible() etc.
It also might be pure WaitForCondition() which accepts a condition to wait for.
Ah ok, I think I get it. Sounds like it'd make sense to add these as methods on AutomationUtilities (which is our set of useful UIA wrappers).
Evgenij 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).
Evgenij, could you clarify where (which API / class) do you want these methods on? Thanks