public class HtmlElements extends java.util.ArrayList<HtmlElement>
HtmlElement
instances.
Find HtmlElements
by using the Browser.query(com.abmash.core.query.predicate.Predicate...)
method.
The HtmlQuery.find()
method returns HtmlElements
. See HtmlQuery
how to find elements.
Example:
HtmlElement myElement = browser.query().isTitle().isClickable().has("today").findFirst();
directly searches
for clickable titles labeled today and returns the HtmlElement
HtmlQuery
for more examples
Bulk interactions on all contained elements can be executed by calling the appropriate methods, e.g. type(String)
or clear()
.
HtmlElement
,
Serialized FormConstructor and Description |
---|
HtmlElements()
Constructs new empty list.
|
HtmlElements(Browser browser,
java.util.List<org.openqa.selenium.WebElement> webElements)
/**
Constructs new list with multiple Selenium
WebElement instances. |
HtmlElements(HtmlElement element)
Constructs new list with one element.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(HtmlElement element)
Adds an
HtmlElement to the list. |
boolean |
addAll(java.util.Collection<? extends HtmlElement> elements)
Adds all
HtmlElements to the list. |
boolean |
addAllAndIgnoreDuplicates(java.util.Collection<? extends HtmlElement> elements)
Adds all
HtmlElements not existing in the list yet. |
boolean |
addAndIgnoreDuplicates(HtmlElement element)
Adds an
HtmlElement if it not exists in the list yet. |
void |
clear()
Clears the entered text in all elements.
|
HtmlElements |
click()
Clicks all elements.
|
boolean |
contains(HtmlElement element)
Checks if the list contains a HtmlElement.
|
HtmlElements |
dragTo(HtmlElement targetElement)
Drags all elements to a target element.
|
HtmlElement |
first()
Gets the first item of the list.
|
java.util.ArrayList<java.lang.String> |
getTexts()
Gets all inner texts of the elements.
|
java.util.ArrayList<java.lang.String> |
getUrls()
Gets all extracted URLs of the elements.
|
HtmlElements |
hover()
Hovers all elements with the mouse.
|
HtmlElements |
keyPress(java.lang.String keyName)
Presses key on all elements.
|
HtmlElement |
last()
Gets the last item of the list.
|
HtmlElement |
nth(int index)
Gets the nth item of the list.
|
HtmlElement |
second()
Gets the second item of the list.
|
void |
setTypes(java.util.ArrayList<com.abmash.REMOVE.core.htmlquery.condition.ElementCondition.ElementType> types)
Sets the type of all elements.
|
HtmlElements |
submit()
Submits all elements.
|
HtmlElement |
third()
Gets the third item of the list.
|
java.lang.String |
toString() |
HtmlElements |
type(java.lang.String text)
Enters text in all elements.
|
public HtmlElements()
public HtmlElements(HtmlElement element)
element
- the first element in the listHtmlElement
public HtmlElements(Browser browser, java.util.List<org.openqa.selenium.WebElement> webElements)
WebElement
instances.browser
- browser instance in which these elements are containedwebElements
- list of Selenium WebElement
HtmlElement
public HtmlElements click()
Warning: if clicking an element causes the page to reload, the other clicks will fail and throw an error.
HtmlElements
HtmlElement.click()
public HtmlElements hover()
HtmlElements
HtmlElement.hover()
public HtmlElements dragTo(HtmlElement targetElement)
targetElement
- the element to drag the elements toHtmlElements
HtmlElement.click()
public void clear()
clear
in interface java.util.Collection<HtmlElement>
clear
in interface java.util.List<HtmlElement>
clear
in class java.util.ArrayList<HtmlElement>
HtmlElement.clear()
public HtmlElements type(java.lang.String text)
text
- HtmlElements
HtmlElement.type(String)
public HtmlElements keyPress(java.lang.String keyName)
keyName
- HtmlElements
HtmlElement.keyPress(String)
public HtmlElements submit()
HtmlElements
HtmlElement.submit()
public java.util.ArrayList<java.lang.String> getTexts()
HtmlElement.getText()
public java.util.ArrayList<java.lang.String> getUrls()
HtmlElement.getText()
public void setTypes(java.util.ArrayList<com.abmash.REMOVE.core.htmlquery.condition.ElementCondition.ElementType> types)
types
- HtmlElement.setTypes(ArrayList)
public boolean add(HtmlElement element)
HtmlElement
to the list. If you want to ignore duplicates use addAndIgnoreDuplicates(HtmlElement)
.add
in interface java.util.Collection<HtmlElement>
add
in interface java.util.List<HtmlElement>
add
in class java.util.ArrayList<HtmlElement>
ArrayList.add(java.lang.Object)
public boolean addAndIgnoreDuplicates(HtmlElement element)
HtmlElement
if it not exists in the list yet.ArrayList.add(java.lang.Object)
public boolean addAll(java.util.Collection<? extends HtmlElement> elements)
HtmlElements
to the list. If you want to ignore duplicates use addAllAndIgnoreDuplicates(Collection)
.addAll
in interface java.util.Collection<HtmlElement>
addAll
in interface java.util.List<HtmlElement>
addAll
in class java.util.ArrayList<HtmlElement>
ArrayList.addAll(java.util.Collection)
public boolean addAllAndIgnoreDuplicates(java.util.Collection<? extends HtmlElement> elements)
HtmlElements
not existing in the list yet.ArrayList.addAll(java.util.Collection)
public boolean contains(HtmlElement element)
element
- public HtmlElement nth(int index)
index
- number of the item, first item has index onepublic HtmlElement first()
public HtmlElement second()
public HtmlElement third()
public HtmlElement last()
public java.lang.String toString()
toString
in class java.util.AbstractCollection<HtmlElement>