Package com.teamdev.jxbrowser.dom
Interface SearchContext
- All Known Subinterfaces:
Attribute
,Document
,Element
,FormControlElement
,FormElement
,FrameElement
,ImageElement
,InputElement
,Node
,OptionElement
,SelectElement
,TextAreaElement
public interface SearchContext
Base interface for search methods that must be inherited by the DOM interfaces that want to have
search mechanisms.
-
Method Summary
Modifier and TypeMethodDescriptionfindElementByClassName
(String className) Returns the firstElement
object found in the current search context by the givenclassName
.findElementByCssSelector
(String cssSelector) Returns the firstElement
object found in the current search context by the givencssSelector
.Returns the firstElement
object found in the current search context by the givenid
.findElementByName
(String name) Returns the firstElement
object found in the current search context by the givenname
.findElementByTagName
(String tagName) Returns the firstElement
object found in the current search context by the giventagName
.findElementsByClassName
(String className) Returns an immutable list of theElement
objects found in the current search context by the givenclassName
.findElementsByCssSelector
(String cssSelector) Returns an immutable list of theElement
objects found in the current search context by the givencssSelector
.Returns an immutable list of theElement
objects found in the current search context by the givenid
.findElementsByName
(String name) Returns an immutable list of theElement
objects found in the current search context by the givenname
.findElementsByTagName
(String tagName) Returns an immutable list of theElement
objects found in the current search context by the giventagName
.
-
Method Details
-
findElementsByClassName
Returns an immutable list of theElement
objects found in the current search context by the givenclassName
. Returns an empty list if no elements were found.- Parameters:
className
- a string that represents the class attribute of the HTML element- Throws:
IllegalArgumentException
- if the givenclassName
is emptyObjectClosedException
- when this instance is closed
-
findElementsByCssSelector
Returns an immutable list of theElement
objects found in the current search context by the givencssSelector
. Returns an empty list if no elements were found.- Parameters:
cssSelector
- a string that represents the CSS selector- Throws:
IllegalArgumentException
- if the givencssSelector
is emptyObjectClosedException
- when this instance is closed
-
findElementsById
Returns an immutable list of theElement
objects found in the current search context by the givenid
. Returns an empty list if no elements were found.- Parameters:
id
- a string that represents the id attribute of the HTML element- Throws:
IllegalArgumentException
- if the givenid
is emptyObjectClosedException
- when this instance is closed
-
findElementsByName
Returns an immutable list of theElement
objects found in the current search context by the givenname
. Returns an empty list if no elements were found.- Parameters:
name
- a string that represents the name attribute of the HTML element- Throws:
IllegalArgumentException
- if the givenname
is emptyObjectClosedException
- when this instance is closed
-
findElementsByTagName
Returns an immutable list of theElement
objects found in the current search context by the giventagName
. Returns an empty list if no elements were found.- Parameters:
tagName
- a string that represents the tag name of the HTML element- Throws:
IllegalArgumentException
- if the giventagName
is emptyObjectClosedException
- when this instance is closed
-
findElementByClassName
Returns the firstElement
object found in the current search context by the givenclassName
. Returns an emptyOptional
if no element was found.- Parameters:
className
- a string that represents the class attribute of the HTML element- Throws:
IllegalArgumentException
- if the givenclassName
is emptyObjectClosedException
- when this instance is closed
-
findElementByCssSelector
Returns the firstElement
object found in the current search context by the givencssSelector
. Returns an emptyOptional
if no element was found.- Parameters:
cssSelector
- a string that represents the CSS selector- Throws:
IllegalArgumentException
- if the givencssSelector
is emptyObjectClosedException
- when this instance is closed
-
findElementById
Returns the firstElement
object found in the current search context by the givenid
. Returns an emptyOptional
if no element was found.- Parameters:
id
- a string that represents the id attribute of the HTML element- Throws:
IllegalArgumentException
- if the givenid
is emptyObjectClosedException
- when this instance is closed
-
findElementByName
Returns the firstElement
object found in the current search context by the givenname
. Returns an emptyOptional
if no element was found.- Parameters:
name
- a string that represents the name attribute of the HTML element- Throws:
IllegalArgumentException
- if the givenname
is emptyObjectClosedException
- when this instance is closed
-
findElementByTagName
Returns the firstElement
object found in the current search context by the giventagName
. Returns an emptyOptional
if no element was found.- Parameters:
tagName
- a string that represents the tag name of the HTML element- Throws:
IllegalArgumentException
- if the giventagName
is emptyObjectClosedException
- when this instance is closed
-