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)
| 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. |
no outgoing calls