/// <summary> /// Finds the element which is in the given treescope with the given condition and the given index within the given timeout period. /// </summary> public AutomationElement FindAt(TreeScope treeScope, ConditionBase condition, int index, TimeSpan timeOut) { Predicate <AutomationElement> whilePredicate = element => element == null; Func <AutomationElement> retryMethod = () => BasicAutomationElement.FindIndexed(treeScope, index, 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)); }
/// <summary> /// Finds all elements in the given treescope and with the given condition within the given timeout. /// </summary> public AutomationElement[] FindAll(TreeScope treeScope, ConditionBase condition, TimeSpan timeOut) { Predicate <AutomationElement[]> whilePredicate = elements => elements.Length == 0; Func <AutomationElement[]> retryMethod = () => BasicAutomationElement.FindAll(treeScope, condition); return(Retry.While(retryMethod, whilePredicate, timeOut)); }
/// <summary> /// Finds all elements in the given treescope and condition within the given timeout. /// </summary> public AutomationElement[] FindAll(TreeScope treeScope, ConditionBase condition, TimeSpan timeOut) { Predicate <AutomationElement[]> shouldRetry = elements => elements.Length == 0; Func <AutomationElement[]> func = () => BasicAutomationElement.FindAll(treeScope, condition); return(Retry.For(func, shouldRetry, timeOut)); }
/// <inheritdoc /> public bool TryGetPattern(out T pattern) { if (BasicAutomationElement.TryGetNativePattern(_patternId, out TNative nativePattern)) { pattern = _patternCreateFunc(BasicAutomationElement, nativePattern); return(true); } pattern = default(T); return(false); }
/// <summary> /// Gets a clickable point of the element. /// </summary> /// <exception cref="Exceptions.NoClickablePointException">Thrown when no clickable point was found</exception> public Shapes.Point GetClickablePoint() { return(BasicAutomationElement.GetClickablePoint()); }
/// <summary> /// Sets the focus to this element. /// Warning: This can be unreliable! <see cref="SetForeground" /> should be more reliable. /// </summary> public virtual void Focus() { BasicAutomationElement.SetFocus(); }
/// <summary> /// Sets focus onto control using UIA native element /// </summary> protected virtual void SetFocus() { BasicAutomationElement.SetFocus(); }
public bool TryGetValue(out TVal value) { return(BasicAutomationElement.TryGetPropertyValue(PropertyId, out value)); }
public IAutomationEventHandler RegisterEvent(EventId @event, TreeScope treeScope, Action <AutomationElement, EventId> action) { return(BasicAutomationElement.RegisterEvent(@event, treeScope, action)); }
protected T Get <T>(PropertyId property) { return(BasicAutomationElement.SafeGetPropertyValue <T>(property, Cached)); }