Exemplo n.º 1
0
        /// <summary>
        /// Finds for the first item which matches the given xpath.
        /// </summary>
        public UiElement FindFirstByXPath(string xPath)
        {
            var xPathNavigator = new AutomationElementXPathNavigator(this);
            var nodeItem       = xPathNavigator.SelectSingleNode(xPath);

            return((UiElement)nodeItem?.UnderlyingObject);
        }
        /// <inheritdoc/>
        public override XPathNavigator Clone()
        {
            var clonedObject = new AutomationElementXPathNavigator(this.rootElement)
            {
                currentElement = this.currentElement,
                attributeIndex = this.attributeIndex,
            };

            return(clonedObject);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Finds all items which match the given xpath.
        /// </summary>
        public IReadOnlyList <UiElement> FindAllByXPath(string xPath)
        {
            var xPathNavigator   = new AutomationElementXPathNavigator(this);
            var itemNodeIterator = xPathNavigator.Select(xPath);
            var itemList         = new List <UiElement>();

            while (itemNodeIterator.MoveNext())
            {
                var automationItem = (UiElement)itemNodeIterator.Current.UnderlyingObject;
                itemList.Add(automationItem);
            }

            return(itemList.ToArray());
        }