MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / getElements

Method getElements

src/main/java/org/htmlunit/html/HtmlForm.java:607–627  ·  view source on GitHub ↗

@param filter a predicate to filter the element @return all elements attached to this form and matching the filter predicate

(final Predicate<HtmlElement> filter)

Source from the content-addressed store, hash-verified

605 * @return all elements attached to this form and matching the filter predicate
606 */
607 public List<HtmlElement> getElements(final Predicate<HtmlElement> filter) {
608 final List<HtmlElement> elements = new ArrayList<>();
609
610 if (isAttachedToPage()) {
611 for (final HtmlElement element : getPage().getDocumentElement().getHtmlElementDescendants()) {
612 if (filter.test(element)
613 && element.getEnclosingForm() == this) {
614 elements.add(element);
615 }
616 }
617 }
618 else {
619 for (final HtmlElement element : getHtmlElementDescendants()) {
620 if (filter.test(element)) {
621 elements.add(element);
622 }
623 }
624 }
625
626 return elements;
627 }
628
629 /**
630 * Returns the first input element which is a member of this form and has the specified name.

Callers 7

areChildrenValidMethod · 0.95
getFormElementsMethod · 0.95
getElementsJSMethod · 0.95
getInputsByValueMethod · 0.95
parseMethod · 0.45

Calls 7

getPageMethod · 0.65
isAttachedToPageMethod · 0.45
getDocumentElementMethod · 0.45
testMethod · 0.45
getEnclosingFormMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected