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

Method findElement

java/src/org/openqa/selenium/By.java:123–129  ·  view source on GitHub ↗

Find a single element. Override this method if necessary. @param context A context to use to find the element. @return The WebElement that matches the selector.

(SearchContext context)

Source from the content-addressed store, hash-verified

121 * @return The WebElement that matches the selector.
122 */
123 public WebElement findElement(SearchContext context) {
124 List<WebElement> allElements = findElements(context);
125 if (allElements == null || allElements.isEmpty()) {
126 throw new NoSuchElementException("Cannot locate an element using " + this);
127 }
128 return allElements.get(0);
129 }
130
131 /**
132 * Find many elements.

Callers

nothing calls this directly

Calls 3

findElementsMethod · 0.95
getMethod · 0.65
isEmptyMethod · 0.45

Tested by

no test coverage detected