/// <summary> /// Finds the first element which is in the given treescope with the given condition within the given timeout period. /// </summary> public AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition, TimeSpan timeOut) { Predicate <AutomationElement> whilePredicate = element => element == null; Func <AutomationElement> retryMethod = () => BasicAutomationElement.FindFirst(treeScope, condition); return(Retry.While(retryMethod, whilePredicate, timeOut)); }
/// <summary> /// Finds the first element which is in the given treescope and matches the condition within the given timeout period. /// </summary> public AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition, TimeSpan timeOut) { Predicate <AutomationElement> shouldRetry = element => element == null; Func <AutomationElement> func = () => BasicAutomationElement.FindFirst(treeScope, condition); return(Retry.For(func, shouldRetry, timeOut)); }