MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / XPath

Method XPath

dotnet/src/webdriver/By.cs:216–227  ·  view source on GitHub ↗

Gets a mechanism to find elements by an XPath query. When searching within a WebElement using xpath be aware that WebDriver follows standard conventions: a search prefixed with "//" will search the entire document, not just the children of this current node. Use ".//" to limit your search to the children of this WebElement. The XPath query to use.</pa

(string xpathToFind)

Source from the content-addressed store, hash-verified

214 /// <returns>A <see cref="By"/> object the driver can use to find the elements.</returns>
215 /// <exception cref="ArgumentNullException">If <paramref name="xpathToFind"/> is null.</exception>
216 public static By XPath(string xpathToFind)
217 {
218 if (xpathToFind == null)
219 {
220 throw new ArgumentNullException(nameof(xpathToFind), "Cannot find elements when the XPath expression is null.");
221 }
222
223 return new By(XPathSelectorMechanism, xpathToFind)
224 {
225 Description = "By.XPath: " + xpathToFind
226 };
227 }
228
229 /// <summary>
230 /// Gets a mechanism to find elements by their CSS class.

Calls

no outgoing calls