public class ElementsCollection extends java.util.AbstractList<SelenideElement>
Constructor and Description |
---|
ElementsCollection(CollectionSource collection) |
ElementsCollection(Driver driver,
By seleniumSelector) |
ElementsCollection(Driver driver,
java.util.Collection<? extends WebElement> elements) |
ElementsCollection(Driver driver,
java.lang.String cssSelector) |
ElementsCollection(Driver driver,
WebElement parent,
By seleniumSelector) |
ElementsCollection(Driver driver,
WebElement parent,
java.lang.String cssSelector) |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
elementsToString(Driver driver,
java.util.Collection<WebElement> elements)
Outputs string presentation of the element's collection
|
ElementsCollection |
exclude(Condition condition)
Filters elements excluding those which met the given condition (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
ElementsCollection |
excludeWith(Condition condition)
Filters elements excluding those which met the given condition (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
ElementsCollection |
filter(Condition condition)
Filters collection elements based on the given condition (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
ElementsCollection |
filterBy(Condition condition)
Filters collection elements based on the given condition (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
SelenideElement |
find(Condition condition)
Find the first element which met the given condition (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
SelenideElement |
findBy(Condition condition)
Find the first element which met the given condition (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
SelenideElement |
first()
returns the first element of the collection
ATTENTION! Doesn't start any search yet.
|
ElementsCollection |
first(int elements)
returns the first n elements of the collection (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
SelenideElement |
get(int index)
Gets the n-th element of collection (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
java.util.Iterator<SelenideElement> |
iterator() |
SelenideElement |
last()
returns the last element of the collection (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
ElementsCollection |
last(int elements)
returns the last n elements of the collection (lazy evaluation)
ATTENTION! Doesn't start any search yet.
|
java.util.ListIterator<SelenideElement> |
listIterator(int index) |
protected ElementsCollection |
should(java.lang.String prefix,
long timeoutMs,
CollectionCondition... conditions) |
ElementsCollection |
shouldBe(CollectionCondition... conditions)
For example:
$$(".error").shouldBe(empty) |
ElementsCollection |
shouldBe(CollectionCondition condition,
long timeoutMs) |
ElementsCollection |
shouldHave(CollectionCondition... conditions)
For example:
$$(".error").shouldHave(size(3))
$$(".error").shouldHave(texts("Error1", "Error2")) |
ElementsCollection |
shouldHave(CollectionCondition condition,
long timeoutMs)
Check if a collection matches given condition within given period
|
ElementsCollection |
shouldHaveSize(int expectedSize)
Deprecated.
|
int |
size()
return actual size of the collection, doesn't wait on collection to be loaded.
|
ElementsCollection |
snapshot()
Takes the snapshot of current state of this collection.
|
java.util.List<java.lang.String> |
texts()
Gets all the texts in elements collection
|
static java.util.List<java.lang.String> |
texts(java.util.Collection<WebElement> elements)
Fail-safe method for retrieving texts of given elements.
|
java.lang.Object[] |
toArray() |
java.lang.String |
toString() |
protected void |
waitUntil(CollectionCondition condition,
long timeoutMs) |
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
public ElementsCollection(CollectionSource collection)
public ElementsCollection(Driver driver, java.util.Collection<? extends WebElement> elements)
public ElementsCollection(Driver driver, java.lang.String cssSelector)
public ElementsCollection(Driver driver, By seleniumSelector)
public ElementsCollection(Driver driver, WebElement parent, java.lang.String cssSelector)
public ElementsCollection(Driver driver, WebElement parent, By seleniumSelector)
public ElementsCollection shouldHaveSize(int expectedSize)
$$.shouldHave(size(expectedSize))
instead.public ElementsCollection shouldBe(CollectionCondition... conditions)
$$(".error").shouldBe(empty)
public ElementsCollection shouldBe(CollectionCondition condition, long timeoutMs)
public ElementsCollection shouldHave(CollectionCondition... conditions)
$$(".error").shouldHave(size(3))
$$(".error").shouldHave(texts("Error1", "Error2"))
public ElementsCollection shouldHave(CollectionCondition condition, long timeoutMs)
timeoutMs
- maximum waiting time in millisecondsprotected ElementsCollection should(java.lang.String prefix, long timeoutMs, CollectionCondition... conditions)
protected void waitUntil(CollectionCondition condition, long timeoutMs)
public ElementsCollection filter(Condition condition)
condition
- conditionpublic ElementsCollection filterBy(Condition condition)
condition
- conditionfilter(Condition)
public ElementsCollection exclude(Condition condition)
condition
- conditionpublic ElementsCollection excludeWith(Condition condition)
condition
- conditionexclude(Condition)
public SelenideElement find(Condition condition)
condition
- conditionpublic SelenideElement findBy(Condition condition)
condition
- conditionfind(Condition)
public java.util.List<java.lang.String> texts()
public static java.util.List<java.lang.String> texts(java.util.Collection<WebElement> elements)
elements
- Any collection of WebElementspublic static java.lang.String elementsToString(Driver driver, java.util.Collection<WebElement> elements)
elements
- elements of stringpublic SelenideElement get(int index)
get
in interface java.util.List<SelenideElement>
get
in class java.util.AbstractList<SelenideElement>
index
- 0..Npublic SelenideElement first()
public SelenideElement last()
public ElementsCollection first(int elements)
elements
- number of elements 1..Npublic ElementsCollection last(int elements)
elements
- number of elements 1..Npublic int size()
size
in interface java.util.Collection<SelenideElement>
size
in interface java.util.List<SelenideElement>
size
in class java.util.AbstractCollection<SelenideElement>
public java.util.Iterator<SelenideElement> iterator()
iterator
in interface java.lang.Iterable<SelenideElement>
iterator
in interface java.util.Collection<SelenideElement>
iterator
in interface java.util.List<SelenideElement>
iterator
in class java.util.AbstractList<SelenideElement>
public java.util.ListIterator<SelenideElement> listIterator(int index)
listIterator
in interface java.util.List<SelenideElement>
listIterator
in class java.util.AbstractList<SelenideElement>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<SelenideElement>
toArray
in interface java.util.List<SelenideElement>
toArray
in class java.util.AbstractCollection<SelenideElement>
public ElementsCollection snapshot()
public java.lang.String toString()
toString
in class java.util.AbstractCollection<SelenideElement>