コード例 #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
ファイル: DescendantFinder.cs プロジェクト: EDOlsson/White
 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);
 }
コード例 #5
0
 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;
 }
コード例 #7
0
 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();
 }
コード例 #12
0
 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));
 }
コード例 #14
0
 public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition)
 {
     return(automationElement.FindFirst(TreeScope.Children, automationSearchCondition.Condition));
 }
コード例 #15
0
 public virtual List <AutomationElement> Children(AutomationSearchCondition automationSearchCondition)
 {
     return(automationElement.FindAll(TreeScope.Children, automationSearchCondition.Condition).Cast <AutomationElement>().ToList());
 }
コード例 #16
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));
 }
コード例 #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();
 }
コード例 #26
0
 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;
 }
コード例 #28
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);
 }
コード例 #29
0
 public static AutomationSearchCondition ByName(string name)
 {
     var automationSearchCondition = new AutomationSearchCondition();
     automationSearchCondition.OfName(name);
     return automationSearchCondition;
 }
コード例 #30
0
 public virtual AutomationElement Child(AutomationSearchCondition automationSearchCondition)
 {
     return(FindAll(automationSearchCondition, ElementSearchResult.ForOne(), 1).Elements.FirstOrDefault());
 }