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

Method Name

dotnet/src/webdriver/By.cs:194–205  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Calls

no outgoing calls