private void MatchElement(AutomationElement current, AutomationSearchCondition automationSearchCondition, ElementSearchResult elementSearchResult) { logger.DebugFormat("[RawSearch] Matching: ({0})", current.Display()); if (automationSearchCondition.Satisfies(current)) { logger.DebugFormat("[RawSearch] Matched: ({0})", current.Display()); elementSearchResult.Add(current); } }
private void FindMatchingDescendants(AutomationElement element, AutomationSearchCondition automationSearchCondition, ElementSearchResult elementSearchResult, int depth) { if (depth == 0) { return; } logger.DebugFormat("[RawSearch] Finding descendants of: ({0})", element.Display()); AutomationElement current = RawViewWalker.GetFirstChild(element); while (current != null) { MatchElement(current, automationSearchCondition, elementSearchResult); if (elementSearchResult.AllResultsFound) return; FindMatchingDescendants(current, automationSearchCondition, elementSearchResult, depth - 1); if (elementSearchResult.AllResultsFound) return; current = RawViewWalker.GetNextSibling(current); } }
public static AutomationSearchCondition ByControlType(ControlType controlType) { var automationSearchCondition = new AutomationSearchCondition(); automationSearchCondition.OfControlType(controlType); return automationSearchCondition; }
public static AutomationSearchCondition ByAutomationId(string id) { var automationSearchCondition = new AutomationSearchCondition(); automationSearchCondition.WithAutomationId(id); return automationSearchCondition; }
private bool TryGetPopupMenu(AutomationSearchCondition[] searchConditions, ActionListener actionListener, out PopUpMenu popUpMenu) { var element = Retry.For(() => Finder.Child(searchConditions), CoreAppXmlConfiguration.Instance.PopupTimeout(), TimeSpan.FromMilliseconds(100)); if (element == null) { popUpMenu = null; return false; } popUpMenu = new PopUpMenu(element, actionListener); return true; }
public virtual List<AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition) { return FindAll(automationSearchCondition, ElementSearchResult.ForMany(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements; }
public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition) { return FindAll(automationSearchCondition, ElementSearchResult.ForOne(), 1).Elements.FirstOrDefault(); }
public virtual AutomationElement Descendant(AutomationSearchCondition automationSearchCondition) { return (FindAll(automationSearchCondition, ElementSearchResult.ForOne(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements.FirstOrDefault ()); }
public virtual List<AutomationElement> Children(AutomationSearchCondition automationSearchCondition) { return automationElement.FindAll(TreeScope.Children, automationSearchCondition.Condition).Cast<AutomationElement>().ToList(); }
public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition) { return automationElement.FindFirst(TreeScope.Children, automationSearchCondition.Condition); }
protected virtual AutomationElement Child(int returnLevel, AutomationSearchCondition[] automationSearchConditions) { return new MultiLevelAutomationElementFinder(automationSearchConditions).Find(returnLevel, automationElement); }
public virtual AutomationElement FindChildRaw(AutomationSearchCondition automationSearchCondition) { return(new RawAutomationElementFinder(automationElement).Child(automationSearchCondition)); }
public virtual List <AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition) { return(DescendantFinderFactory.Create(automationElement).Descendants(automationSearchCondition)); }
public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition) { return(automationElement.FindFirst(TreeScope.Children, automationSearchCondition.Condition)); }
public virtual List <AutomationElement> Children(AutomationSearchCondition automationSearchCondition) { return(automationElement.FindAll(TreeScope.Children, automationSearchCondition.Condition).Cast <AutomationElement>().ToList()); }
public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition) { return(FindAll(automationSearchCondition, ElementSearchResult.ForOne(), 1).Elements.FirstOrDefault()); }
public virtual List<AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition) { return DescendantFinderFactory.Create(automationElement).Descendants(automationSearchCondition); }
public virtual List <AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition) { return(FindAll(automationSearchCondition, ElementSearchResult.ForMany(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements); }
public virtual AutomationElement FindChildRaw(AutomationSearchCondition automationSearchCondition) { return new RawAutomationElementFinder(automationElement).Child(automationSearchCondition); }
public virtual AutomationElement Descendant(AutomationSearchCondition automationSearchCondition) { return FindAll(automationSearchCondition, ElementSearchResult.ForOne(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements.FirstOrDefault (); }
/// <summary> /// Uses the Raw View provided by UIAutomation to find elements. RawView sometimes contains extra AutomationElements. This is internal to /// white although made public. Should be used only if the standard approaches dont work. Also if you end up using it please raise an issue /// so that it can be fixed /// Please understand that calling this method on any UIItem which has a lot of child AutomationElements might result in very bad performance. /// </summary> /// <param name="automationSearchCondition"></param> /// <returns>null or found AutomationElement</returns> public virtual AutomationElement FindDescendantRaw(AutomationSearchCondition automationSearchCondition) { return new RawAutomationElementFinder(automationElement).Descendant(automationSearchCondition); }
private ElementSearchResult FindAll(AutomationSearchCondition automationSearchCondition, ElementSearchResult elementSearchResult, int depth) { logger.DebugFormat("[RawSearch] Finding in: ({0})", automationElement.Display()); FindMatchingDescendants(automationElement, automationSearchCondition, elementSearchResult, depth); return elementSearchResult; }
private ElementSearchResult FindAll(AutomationSearchCondition automationSearchCondition, ElementSearchResult elementSearchResult, int depth) { WhiteLogger.Instance.DebugFormat("[RawSearch] Finding in: ({0})", automationElement.Display()); FindMatchingDescendants(automationElement, automationSearchCondition, elementSearchResult, depth); return(elementSearchResult); }
public virtual AutomationElement Descendant(AutomationSearchCondition automationSearchCondition) { return Descendant(automationSearchCondition.Condition); }
public virtual List<AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition) { AutomationElementCollection collection = automationElement.FindAll(TreeScope.Descendants, automationSearchCondition.Condition); var enumerable = collection.Cast<AutomationElement>(); return new List<AutomationElement>(enumerable); }
public static string ToString(AutomationSearchCondition[] conditions) { var builder = new StringBuilder(); foreach (AutomationSearchCondition condition in conditions) builder.AppendLine(condition.ToString()); return builder.ToString(); }
public virtual AutomationElement Descendant(AutomationSearchCondition automationSearchCondition) { return(Descendant(automationSearchCondition.Condition)); }
public static AutomationSearchCondition ByClassName(string className) { var automationSearchCondition = new AutomationSearchCondition(); automationSearchCondition.conditions.Add(new PropertyCondition(AutomationElement.ClassNameProperty, className)); return automationSearchCondition; }
private bool TryGetPopupMenu(AutomationSearchCondition[] searchConditions, ActionListener actionListener, out PopUpMenu popUpMenu) { var clock = new Clock(CoreAppXmlConfiguration.Instance.PopupTimeout, 100); Clock.Do @do = () => finder.Child(searchConditions); Clock.Matched matched = obj => obj != null; var element = (AutomationElement) clock.Perform(@do, matched, () => null); if (element == null) { popUpMenu = null; return false; } popUpMenu = new PopUpMenu(element, actionListener); return true; }
public static AutomationSearchCondition ByName(string name) { var automationSearchCondition = new AutomationSearchCondition(); automationSearchCondition.OfName(name); return automationSearchCondition; }
/// <summary> /// Uses the Raw View provided by UIAutomation to find elements. RawView sometimes contains extra AutomationElements. This is internal to /// white although made public. Should be used only if the standard approaches dont work. Also if you end up using it please raise an issue /// so that it can be fixed /// Please understand that calling this method on any UIItem which has a lot of child AutomationElements might result in very bad performance. /// </summary> /// <param name="automationSearchCondition"></param> /// <returns>null or found AutomationElement</returns> public virtual AutomationElement FindDescendantRaw(AutomationSearchCondition automationSearchCondition) { return(new RawAutomationElementFinder(automationElement).Descendant(automationSearchCondition)); }