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 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; }
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 virtual List<AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition) { var collection = automationElement.FindAll(TreeScope.Descendants, automationSearchCondition.Condition); var enumerable = collection.Cast<AutomationElement>(); return new List<AutomationElement>(enumerable); }
public virtual List <AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition) { return(FindAll(automationSearchCondition, ElementSearchResult.ForMany(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements); }
public static AutomationSearchCondition ByAutomationId(string id) { var automationSearchCondition = new AutomationSearchCondition(); automationSearchCondition.WithAutomationId(id); return automationSearchCondition; }
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); }
/// <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); }
public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition) { return FindAll(automationSearchCondition, ElementSearchResult.ForOne(), 1).Elements.FirstOrDefault(); }
public virtual List<AutomationElement> Children(AutomationSearchCondition automationSearchCondition) { return automationElement.FindAll(TreeScope.Children, automationSearchCondition.Condition).Cast<AutomationElement>().ToList(); }
public virtual List <AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition) { return(DescendantFinderFactory.Create(automationElement).Descendants(automationSearchCondition)); }
public virtual AutomationElement Descendant(AutomationSearchCondition automationSearchCondition) { return(Descendant(automationSearchCondition.Condition)); }
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()); }
/// <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)); }
protected virtual AutomationElement Child(int returnLevel, AutomationSearchCondition[] automationSearchConditions) { return new MultiLevelAutomationElementFinder(automationSearchConditions).Find(returnLevel, automationElement); }
public virtual AutomationElement Descendant(AutomationSearchCondition automationSearchCondition) { return FindAll(automationSearchCondition, ElementSearchResult.ForOne(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements.FirstOrDefault (); }
public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition) { return automationElement.FindFirst(TreeScope.Children, automationSearchCondition.Condition); }
public virtual List<AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition) { return FindAll(automationSearchCondition, ElementSearchResult.ForMany(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements; }
public virtual AutomationElement Descendant(AutomationSearchCondition searchCondition) { return Descendant(searchCondition.Condition); }
private ElementSearchResult FindAll(AutomationSearchCondition automationSearchCondition, ElementSearchResult elementSearchResult, int depth) { logger.DebugFormat("[RawSearch] Finding in: ({0})", automationElement.Display()); FindMatchingDescendants(automationElement, automationSearchCondition, elementSearchResult, depth); return elementSearchResult; }
public virtual AutomationElement FindChildRaw(AutomationSearchCondition automationSearchCondition) { return new RawAutomationElementFinder(automationElement).Child(automationSearchCondition); }
public static AutomationSearchCondition ByControlType(ControlType controlType) { var automationSearchCondition = new AutomationSearchCondition(); automationSearchCondition.OfControlType(controlType); return automationSearchCondition; }
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 (FindAll(automationSearchCondition, ElementSearchResult.ForOne(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements.FirstOrDefault ()); }
public static AutomationSearchCondition ByClassName(string className) { var automationSearchCondition = new AutomationSearchCondition(); automationSearchCondition.conditions.Add(new PropertyCondition(AutomationElement.ClassNameProperty, className)); return 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); }
public static AutomationSearchCondition ByName(string name) { var automationSearchCondition = new AutomationSearchCondition(); automationSearchCondition.OfName(name); return automationSearchCondition; }
public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition) { return(FindAll(automationSearchCondition, ElementSearchResult.ForOne(), 1).Elements.FirstOrDefault()); }