OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByXPath C# (CSharp) Method

FindElementByXPath() public method

Finds the first of elements that match the XPath supplied
public FindElementByXPath ( string xpath ) : IWebElement
xpath string xpath to the element
return IWebElement
        public IWebElement FindElementByXPath(string xpath)
        {
            return this.FindElement("xpath", xpath);
        }

Usage Example

Exemplo n.º 1
0
        protected IWebElement FindElement(RemoteWebDriver webDriver, Selector element)
        {
            switch (element.Type)
            {

                case ExtractType.XPath:
                    {
                        return webDriver.FindElementByXPath(element.Expression);
                    }
                case ExtractType.Css:
                    {
                        return webDriver.FindElementByCssSelector(element.Expression);
                    }
            }
            throw new SpiderExceptoin("Unsport findy: " + element.Type);
        }