public interface SearchContext
Modifier and Type | Method and Description |
---|---|
java.util.Optional<Element> |
findElementByClassName(java.lang.String className)
Returns the first
Element object found in the current search context by the given
className . |
java.util.Optional<Element> |
findElementByCssSelector(java.lang.String cssSelector)
Returns the first
Element object found in the current search context by the given
cssSelector . |
java.util.Optional<Element> |
findElementById(java.lang.String id)
Returns the first
Element object found in the current search context by the given
id . |
java.util.Optional<Element> |
findElementByName(java.lang.String name)
Returns the first
Element object found in the current search context by the given
name . |
java.util.Optional<Element> |
findElementByTagName(java.lang.String tagName)
Returns the first
Element object found in the current search context by the given
tagName . |
java.util.List<Element> |
findElementsByClassName(java.lang.String className)
Returns an immutable list of the
Element objects found in the current search context
by the given className . |
java.util.List<Element> |
findElementsByCssSelector(java.lang.String cssSelector)
Returns an immutable list of the
Element objects found in the current search context
by the given cssSelector . |
java.util.List<Element> |
findElementsById(java.lang.String id)
Returns an immutable list of the
Element objects found in the current search context
by the given id . |
java.util.List<Element> |
findElementsByName(java.lang.String name)
Returns an immutable list of the
Element objects found in the current search context
by the given name . |
java.util.List<Element> |
findElementsByTagName(java.lang.String tagName)
Returns an immutable list of the
Element objects found in the current search context
by the given tagName . |
java.util.List<Element> findElementsByClassName(java.lang.String className)
Element
objects found in the current search context
by the given className
. Returns an empty list if no elements were found.className
- a string that represents the class attribute of the HTML elementjava.lang.IllegalArgumentException
- if the given className
is emptyObjectClosedException
- when the document this instance belongs to is closedjava.util.List<Element> findElementsByCssSelector(java.lang.String cssSelector)
Element
objects found in the current search context
by the given cssSelector
. Returns an empty list if no elements were found.cssSelector
- a string that represents the CSS selectorjava.lang.IllegalArgumentException
- if the given cssSelector
is emptyObjectClosedException
- when the document this instance belongs to is closedjava.util.List<Element> findElementsById(java.lang.String id)
Element
objects found in the current search context
by the given id
. Returns an empty list if no elements were found.id
- a string that represents the id attribute of the HTML elementjava.lang.IllegalArgumentException
- if the given id
is emptyObjectClosedException
- when the document this instance belongs to is closedjava.util.List<Element> findElementsByName(java.lang.String name)
Element
objects found in the current search context
by the given name
. Returns an empty list if no elements were found.name
- a string that represents the name attribute of the HTML elementjava.lang.IllegalArgumentException
- if the given name
is emptyObjectClosedException
- when the document this instance belongs to is closedjava.util.List<Element> findElementsByTagName(java.lang.String tagName)
Element
objects found in the current search context
by the given tagName
. Returns an empty list if no elements were found.tagName
- a string that represents the tag name of the HTML elementjava.lang.IllegalArgumentException
- if the given tagName
is emptyObjectClosedException
- when the document this instance belongs to is closedjava.util.Optional<Element> findElementByClassName(java.lang.String className)
Element
object found in the current search context by the given
className
. Returns an empty Optional
if no element was found.className
- a string that represents the class attribute of the HTML elementjava.lang.IllegalArgumentException
- if the given className
is emptyObjectClosedException
- when the document this instance belongs to is closedjava.util.Optional<Element> findElementByCssSelector(java.lang.String cssSelector)
Element
object found in the current search context by the given
cssSelector
. Returns an empty Optional
if no element was found.cssSelector
- a string that represents the CSS selectorjava.lang.IllegalArgumentException
- if the given cssSelector
is emptyObjectClosedException
- when the document this instance belongs to is closedjava.util.Optional<Element> findElementById(java.lang.String id)
Element
object found in the current search context by the given
id
. Returns an empty Optional
if no element was found.id
- a string that represents the id attribute of the HTML elementjava.lang.IllegalArgumentException
- if the given id
is emptyObjectClosedException
- when the document this instance belongs to is closedjava.util.Optional<Element> findElementByName(java.lang.String name)
Element
object found in the current search context by the given
name
. Returns an empty Optional
if no element was found.name
- a string that represents the name attribute of the HTML elementjava.lang.IllegalArgumentException
- if the given name
is emptyObjectClosedException
- when the document this instance belongs to is closedjava.util.Optional<Element> findElementByTagName(java.lang.String tagName)
Element
object found in the current search context by the given
tagName
. Returns an empty Optional
if no element was found.tagName
- a string that represents the tag name of the HTML elementjava.lang.IllegalArgumentException
- if the given tagName
is emptyObjectClosedException
- when the document this instance belongs to is closed