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

Method FindElement

dotnet/src/webdriver/By.cs:317–325  ·  view source on GitHub ↗

Finds the first element matching the criteria. An object to use to search for the elements. The first matching on the current context. If no element matches the criteria.

(ISearchContext context)

Source from the content-addressed store, hash-verified

315 /// <returns>The first matching <see cref="IWebElement"/> on the current context.</returns>
316 /// <exception cref="NoSuchElementException">If no element matches the criteria.</exception>
317 public virtual IWebElement FindElement(ISearchContext context)
318 {
319 if (this.FindElementMethod is not { } findElementMethod)
320 {
321 throw new InvalidOperationException("FindElement method not set. Override the By.FindElement method, set the By.FindElementMethod property, or use a constructor that sets a query mechanism.");
322 }
323
324 return findElementMethod(context);
325 }
326
327 /// <summary>
328 /// Finds all elements matching the criteria.

Callers 1

ByMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected