Gets a mechanism to find elements by their name. The name to find. A object the driver can use to find the elements. If is null.
(string nameToFind)
| 192 | /// <returns>A <see cref="By"/> object the driver can use to find the elements.</returns> |
| 193 | /// <exception cref="ArgumentNullException">If <paramref name="nameToFind"/> is null.</exception> |
| 194 | public static By Name(string nameToFind) |
| 195 | { |
| 196 | if (nameToFind == null) |
| 197 | { |
| 198 | throw new ArgumentNullException(nameof(nameToFind), "Cannot find elements when name text is null."); |
| 199 | } |
| 200 | |
| 201 | return new By(CssSelectorMechanism, $"*[name =\"{EscapeCssSelector(nameToFind)}\"]") |
| 202 | { |
| 203 | Description = "By.Name: " + nameToFind |
| 204 | }; |
| 205 | } |
| 206 | |
| 207 | /// <summary> |
| 208 | /// Gets a mechanism to find elements by an XPath query. |
no outgoing calls