Retrieves all element nodes from descendants of the starting element node that match any selector within the supplied selector strings. @param selectors one or more CSS selectors separated by commas @return list of all found nodes
(final String selectors)
| 2044 | * @return list of all found nodes |
| 2045 | */ |
| 2046 | public DomNodeList<DomNode> querySelectorAll(final String selectors) { |
| 2047 | try { |
| 2048 | final WebClient webClient = getPage().getWebClient(); |
| 2049 | final SelectorList selectorList = getSelectorList(selectors, webClient); |
| 2050 | |
| 2051 | final List<DomNode> elements = new ArrayList<>(); |
| 2052 | if (selectorList != null) { |
| 2053 | for (final DomElement child : getDomElementDescendants()) { |
| 2054 | for (final Selector selector : selectorList) { |
| 2055 | if (CssStyleSheet.selects(webClient.getBrowserVersion(), selector, child, null, true, true)) { |
| 2056 | elements.add(child); |
| 2057 | break; |
| 2058 | } |
| 2059 | } |
| 2060 | } |
| 2061 | } |
| 2062 | return new StaticDomNodeList(elements); |
| 2063 | } |
| 2064 | catch (final IOException e) { |
| 2065 | throw new CSSException("Error parsing CSS selectors from '" + selectors + "': " + e.getMessage(), e); |
| 2066 | } |
| 2067 | } |
| 2068 | |
| 2069 | /** |
| 2070 | * Returns the {@link SelectorList}. |
no test coverage detected