Example #1
0
        /// <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));
        }
Example #3
0
        /// <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));
        }
Example #5
0
 /// <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);
 }
Example #6
0
 /// <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());
 }
Example #7
0
 /// <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();
 }
Example #8
0
 /// <summary>
 /// Sets focus onto control using UIA native element
 /// </summary>
 protected virtual void SetFocus()
 {
     BasicAutomationElement.SetFocus();
 }
Example #9
0
 public bool TryGetValue(out TVal value)
 {
     return(BasicAutomationElement.TryGetPropertyValue(PropertyId, out value));
 }
Example #10
0
 public IAutomationEventHandler RegisterEvent(EventId @event, TreeScope treeScope, Action <AutomationElement, EventId> action)
 {
     return(BasicAutomationElement.RegisterEvent(@event, treeScope, action));
 }
Example #11
0
 protected T Get <T>(PropertyId property)
 {
     return(BasicAutomationElement.SafeGetPropertyValue <T>(property, Cached));
 }