IterFind() 공개 메소드

public IterFind ( TreeScope scope, Predicate predicate ) : IEnumerable
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);
        }
예제 #3
0
        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);
            }
        }
예제 #6
0
        public List <string> FindElements(WiniumElement root, By strategy)
        {
            var elements = root.IterFind(TreeScope.Descendants, strategy.Predicate);

            return(elements.Select(this.RegisterElement).ToList());
        }