Find-Element
Search for an element whose xpath matches the given value.
Powershell
Search for an element whose xpath attribute matches the given value. Returns: the first element whose xpath attribute matches the given value. This method will wait for the element to appear on your application during the amount of time specified by Set-Timeout.
Throws an exception there is no element found matching the given xpath.
Syntax
Find-Element [-sessionId
Find-Element [-sessionId
Parameters
name | description |
---|---|
sessionId | (Optional) The identifier of the session to route the command to. |
xpath | The xpath used to locate elements. |
using | |
value | |
ignoreVisibility | (Optional) indicates whether non visible elements should be taken into account. |
parentElement | (Optional) limits the search to only descendants of this element. |
Examples
Find-Element -xpath "*[@marked='login']"
C#
Declaration
OpenQA.Selenium.Internal.IFindsByXPath::IWebElement FindElementByXPath(string xpath);
Arguments:
type | name | description |
---|---|---|
System.String | xpath | The XPath query to match. |
Returns:
type | description |
---|---|
OpenQA.Selenium.IWebElement | The first IWebElement matching the criteria |
Examples
driver.findElementByXPath(xPath);
driver.FindElementById(id);
driver.FindElementByClassName(className);
driver.FindElementByPredicateString(className);
driver.FindElementByClassChain(className);
Comments
FindElementByClassChain and FindElementByPredicateString are only supported on iOS