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)
| 322 | /// <returns>The first matching <see cref="IWebElement"/> on the current context.</returns> |
| 323 | /// <exception cref="NoSuchElementException">If no element matches the criteria.</exception> |
| 324 | public virtual IWebElement FindElement(ISearchContext context) |
| 325 | { |
| 326 | if (this.FindElementMethod is not { } findElementMethod) |
| 327 | { |
| 328 | 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."); |
| 329 | } |
| 330 | |
| 331 | return findElementMethod(context); |
| 332 | } |
| 333 | |
| 334 | /// <summary> |
| 335 | /// Finds all elements matching the criteria. |