public IterFind ( TreeScope scope, Predicate |
||
scope | TreeScope | |
predicate | Predicate |
|
Результат | IEnumerable |
public IEnumerable <WiniumElement> IterFind(TreeScope scope, Predicate <WiniumElement> predicate) { if (scope != TreeScope.Descendants && scope != TreeScope.Children) { throw new ArgumentException("scope should be one of TreeScope.Descendants or TreeScope.Children"); } var walker = new TreeWalker(Condition.TrueCondition); var elementNode = walker.GetFirstChild(this.AutomationElement); while (elementNode != null) { var winiumElement = new WiniumElement(elementNode); if (predicate == null || predicate(winiumElement)) { yield return(winiumElement); } if (scope == TreeScope.Descendants) { foreach (var descendant in winiumElement.IterFind(scope, predicate)) { yield return(descendant); } } elementNode = walker.GetNextSibling(elementNode); } }
public string FindElement(WiniumElement root, By strategy) { var element = root.IterFind(TreeScope.Descendants, strategy.Predicate).FirstOrDefault(); if (element == null) { throw new AutomationException("Element could not be found.", ResponseStatus.NoSuchElement); } return this.RegisterElement(element); }
public string FindElement(WiniumElement root, By strategy) { var element = root.IterFind(TreeScope.Descendants, strategy.Predicate).FirstOrDefault(); if (element == null) { throw new AutomationException("Element could not be found.", ResponseStatus.NoSuchElement); } return(this.RegisterElement(element)); }
public List<string> FindElements(WiniumElement root, By strategy) { var elements = root.IterFind(TreeScope.Descendants, strategy.Predicate); return elements.Select(this.RegisterElement).ToList(); }
public IEnumerable<WiniumElement> IterFind(TreeScope scope, Predicate<WiniumElement> predicate) { if (scope != TreeScope.Descendants && scope != TreeScope.Children) { throw new ArgumentException("scope should be one of TreeScope.Descendants or TreeScope.Children"); } var walker = new TreeWalker(Condition.TrueCondition); var elementNode = walker.GetFirstChild(this.AutomationElement); while (elementNode != null) { var winiumElement = new WiniumElement(elementNode); if (predicate == null || predicate(winiumElement)) { yield return winiumElement; } if (scope == TreeScope.Descendants) { foreach (var descendant in winiumElement.IterFind(scope, predicate)) { yield return descendant; } } elementNode = walker.GetNextSibling(elementNode); } }
public List <string> FindElements(WiniumElement root, By strategy) { var elements = root.IterFind(TreeScope.Descendants, strategy.Predicate); return(elements.Select(this.RegisterElement).ToList()); }