Beispiel #1
0
        /// <summary>
        /// Finds the first element which is in the given treescope with the given condition within the given timeout period.
        /// </summary>
        public UiElement FindAt(TreeScope treeScope, System.Windows.Automation.Condition condition, int index, TimeSpan timeOut)
        {
            if (this.TryFindAt(treeScope, condition, index, timeOut, out var result))
            {
                return(result);
            }

            throw new InvalidOperationException($"Did not find an element matching {condition.Description()} at index {index}.");
        }
Beispiel #2
0
        /// <summary>
        /// Finds the first element which is in the given treescope with the given condition within the given timeout period.
        /// </summary>
        public T FindFirst <T>(TreeScope treeScope, System.Windows.Automation.Condition condition, Func <AutomationElement, T> wrap, TimeSpan timeOut)
            where T : UiElement
        {
            if (this.TryFindFirst(treeScope, condition, wrap, timeOut, out var result))
            {
                return(result);
            }

            throw new InvalidOperationException($"Did not find a {typeof(T).Name} matching {condition.Description()}.");
        }