예제 #1
0
 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);
     }
 }
예제 #2
0
 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;
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
 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);
 }
예제 #6
0
 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));
 }
예제 #8
0
 public virtual List<AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition)
 {
     return DescendantFinderFactory.Create(automationElement).Descendants(automationSearchCondition);
 }
예제 #9
0
 /// <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);
 }
예제 #10
0
 public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition)
 {
     return FindAll(automationSearchCondition, ElementSearchResult.ForOne(), 1).Elements.FirstOrDefault();
 }
예제 #11
0
 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));
 }
예제 #13
0
 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));
 }
예제 #17
0
 protected virtual AutomationElement Child(int returnLevel, AutomationSearchCondition[] automationSearchConditions)
 {
     return new MultiLevelAutomationElementFinder(automationSearchConditions).Find(returnLevel, automationElement);
 }
예제 #18
0
 public virtual AutomationElement Descendant(AutomationSearchCondition automationSearchCondition)
 {
     return
         FindAll(automationSearchCondition, ElementSearchResult.ForOne(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements.FirstOrDefault
             ();
 }
예제 #19
0
 public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition)
 {
     return automationElement.FindFirst(TreeScope.Children, automationSearchCondition.Condition);
 }
예제 #20
0
 public virtual List<AutomationElement> Descendants(AutomationSearchCondition automationSearchCondition)
 {
     return FindAll(automationSearchCondition, ElementSearchResult.ForMany(), CoreAppXmlConfiguration.Instance.MaxElementSearchDepth).Elements;
 }
예제 #21
0
 public virtual AutomationElement Descendant(AutomationSearchCondition searchCondition)
 {
     return Descendant(searchCondition.Condition);
 }
예제 #22
0
 private ElementSearchResult FindAll(AutomationSearchCondition automationSearchCondition, ElementSearchResult elementSearchResult, int depth)
 {
     logger.DebugFormat("[RawSearch] Finding in: ({0})", automationElement.Display());
     FindMatchingDescendants(automationElement, automationSearchCondition, elementSearchResult, depth);
     return elementSearchResult;
 }
예제 #23
0
 public virtual AutomationElement FindChildRaw(AutomationSearchCondition automationSearchCondition)
 {
     return new RawAutomationElementFinder(automationElement).Child(automationSearchCondition);
 }
예제 #24
0
 public static AutomationSearchCondition ByControlType(ControlType controlType)
 {
     var automationSearchCondition = new AutomationSearchCondition();
     automationSearchCondition.OfControlType(controlType);
     return automationSearchCondition;
 }
예제 #25
0
 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
              ());
 }
예제 #27
0
 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);
 }
예제 #29
0
 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());
 }