Interface DomQueryable
- All Known Subinterfaces:
BodyElement
,ButtonElement
,CanvasElement
,ComponentElement
,DelphiElement
,Document
,Element
,HeadElement
,InputElement
,ItemElement
,JavaObjectElement
,OptionElement
,ScriptElement
,StyleElement
public interface DomQueryable
Represents an object that supports querying its descendant elements.
-
Method Summary
Modifier and TypeMethodDescriptiongetElementsByClassName
(@NotNull String className) Gets an array list of elements with the specified class namegetElementsByTagName
(@NotNull String tagName) Gets an array list of elements by their tag name@Nullable Element
querySelector
(@NotNull String query) Gets the first element that matches the specifiedquery
CSS selector or group of selectors.querySelectorAll
(@NotNull String query) Gets all the elements that match the specifiedquery
CSS selector, or group of selectors.
-
Method Details
-
getElementsByTagName
Gets an array list of elements by their tag name- Parameters:
tagName
- Element tag name- Returns:
- An array list of elements with the specified tag name
- Throws:
NullPointerException
- iftagName
isnull
-
getElementsByClassName
-
querySelectorAll
@NotNull @NotNull List<Element> querySelectorAll(@NotNull @NotNull String query) throws ParserException Gets all the elements that match the specifiedquery
CSS selector, or group of selectors.- Parameters:
query
- CSS selector- Returns:
- Array list of all matching elements, may be empty
- Throws:
ParserException
- If thequery
could not be parsed into a CSS selector
-
querySelector
Gets the first element that matches the specifiedquery
CSS selector or group of selectors.Matching is done in a depth-first traversal of nodes.
- Parameters:
query
- CSS Selector- Returns:
- Found element, or
null
, if no matching node was found - Throws:
ParserException
- If thequery
could not be parsed into a CSS selector
-