MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / querySelector

Method querySelector

src/main/java/org/htmlunit/html/DomNode.java:2105–2112  ·  view source on GitHub ↗

Returns the first element within the document that matches the specified group of selectors. @param selectors one or more CSS selectors separated by commas @param the node type @return null if no matches are found; otherwise, it returns the first matching element

(final String selectors)

Source from the content-addressed store, hash-verified

2103 * @return null if no matches are found; otherwise, it returns the first matching element
2104 */
2105 @SuppressWarnings("unchecked")
2106 public <N extends DomNode> N querySelector(final String selectors) {
2107 final DomNodeList<DomNode> list = querySelectorAll(selectors);
2108 if (!list.isEmpty()) {
2109 return (N) list.get(0);
2110 }
2111 return null;
2112 }
2113
2114 /**
2115 * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>

Callers

nothing calls this directly

Calls 3

querySelectorAllMethod · 0.95
isEmptyMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected