MCPcopy
hub / github.com/SeleniumHQ/selenium / findElement

Method findElement

java/src/org/openqa/selenium/By.java:122–128  ·  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

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