@ParametersAreNonnullByDefault public class ElementsCollection extends java.util.AbstractList<SelenideElement>
| Constructor and Description |
|---|
ElementsCollection(CollectionSource collection) |
ElementsCollection(Driver driver,
org.openqa.selenium.By seleniumSelector) |
ElementsCollection(Driver driver,
java.util.Collection<? extends org.openqa.selenium.WebElement> elements) |
ElementsCollection(Driver driver,
java.lang.String cssSelector) |
ElementsCollection(Driver driver,
org.openqa.selenium.WebElement parent,
org.openqa.selenium.By seleniumSelector) |
ElementsCollection(Driver driver,
org.openqa.selenium.WebElement parent,
java.lang.String cssSelector) |
| Modifier and Type | Method and Description |
|---|---|
ElementsCollection |
as(java.lang.String alias)
Give this collection a human-readable name
Caution: you probably don't need this method.
|
static java.lang.String |
elementsToString(Driver driver,
java.util.Collection<org.openqa.selenium.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) |
ElementsCollection |
should(CollectionCondition... conditions)
Check if a collection matches given condition(s).
|
ElementsCollection |
should(CollectionCondition condition,
java.time.Duration timeout)
Check if a collection matches a given condition within the given time period.
|
protected ElementsCollection |
should(java.lang.String prefix,
java.time.Duration timeout,
CollectionCondition... conditions) |
ElementsCollection |
shouldBe(CollectionCondition... conditions)
For example:
$$(".error").shouldBe(empty) |
ElementsCollection |
shouldBe(CollectionCondition condition,
java.time.Duration timeout) |
ElementsCollection |
shouldBe(CollectionCondition condition,
long timeoutMs)
Deprecated.
|
ElementsCollection |
shouldHave(CollectionCondition... conditions)
For example:
$$(".error").shouldHave(size(3))
$$(".error").shouldHave(texts("Error1", "Error2")) |
ElementsCollection |
shouldHave(CollectionCondition condition,
java.time.Duration timeout)
Check if a collection matches given condition within given period
|
ElementsCollection |
shouldHave(CollectionCondition condition,
long timeoutMs)
Deprecated.
|
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<org.openqa.selenium.WebElement> elements)
Fail-safe method for retrieving texts of given elements.
|
java.lang.Object[] |
toArray() |
java.lang.String |
toString() |
protected void |
waitUntil(CollectionCondition condition,
java.time.Duration timeout) |
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic ElementsCollection(CollectionSource collection)
public ElementsCollection(Driver driver, java.util.Collection<? extends org.openqa.selenium.WebElement> elements)
public ElementsCollection(Driver driver, java.lang.String cssSelector)
public ElementsCollection(Driver driver, org.openqa.selenium.By seleniumSelector)
public ElementsCollection(Driver driver, org.openqa.selenium.WebElement parent, java.lang.String cssSelector)
public ElementsCollection(Driver driver, org.openqa.selenium.WebElement parent, org.openqa.selenium.By seleniumSelector)
@Nonnull public ElementsCollection shouldHaveSize(int expectedSize)
$$.shouldHave(size(expectedSize)) instead.@Nonnull public ElementsCollection should(CollectionCondition... conditions)
For example:
$$(".text_list").should(containExactTextsCaseSensitive("text1", "text2"));
$$(".cat_list").should(allMatch("value==cat", el -> el.getAttribute("value").equals("cat")));
@Nonnull public ElementsCollection should(CollectionCondition condition, java.time.Duration timeout)
timeout - maximum waiting time@Nonnull public ElementsCollection shouldBe(CollectionCondition... conditions)
$$(".error").shouldBe(empty)@Nonnull public ElementsCollection shouldBe(CollectionCondition condition, java.time.Duration timeout)
@Nonnull @Deprecated public ElementsCollection shouldBe(CollectionCondition condition, long timeoutMs)
shouldBe(CollectionCondition, Duration)@Nonnull public ElementsCollection shouldHave(CollectionCondition... conditions)
$$(".error").shouldHave(size(3))
$$(".error").shouldHave(texts("Error1", "Error2"))@Nonnull public ElementsCollection shouldHave(CollectionCondition condition, java.time.Duration timeout)
timeout - maximum waiting time@Nonnull @Deprecated public ElementsCollection shouldHave(CollectionCondition condition, long timeoutMs)
shouldHave(CollectionCondition, Duration)timeoutMs - maximum waiting time in millisecondsprotected ElementsCollection should(java.lang.String prefix, java.time.Duration timeout, CollectionCondition... conditions)
protected void waitUntil(CollectionCondition condition, java.time.Duration timeout)
@CheckReturnValue @Nonnull public ElementsCollection filter(Condition condition)
condition - condition@CheckReturnValue @Nonnull public ElementsCollection filterBy(Condition condition)
condition - conditionfilter(Condition)@CheckReturnValue @Nonnull public ElementsCollection exclude(Condition condition)
condition - condition@CheckReturnValue @Nonnull public ElementsCollection excludeWith(Condition condition)
condition - conditionexclude(Condition)@CheckReturnValue @Nonnull public SelenideElement find(Condition condition)
condition - condition@CheckReturnValue @Nonnull public SelenideElement findBy(Condition condition)
condition - conditionfind(Condition)@CheckReturnValue @Nonnull public java.util.List<java.lang.String> texts()
@CheckReturnValue
@Nonnull
public static java.util.List<java.lang.String> texts(@Nullable
java.util.Collection<org.openqa.selenium.WebElement> elements)
elements - Any collection of WebElements@CheckReturnValue @Nonnull public static java.lang.String elementsToString(Driver driver, @Nullable java.util.Collection<org.openqa.selenium.WebElement> elements)
elements - elements of string@CheckReturnValue @Nonnull public SelenideElement get(int index)
get in interface java.util.List<SelenideElement>get in class java.util.AbstractList<SelenideElement>index - 0..N@CheckReturnValue @Nonnull public SelenideElement first()
@CheckReturnValue @Nonnull public SelenideElement last()
@CheckReturnValue @Nonnull public ElementsCollection first(int elements)
elements - number of elements 1..N@CheckReturnValue @Nonnull public ElementsCollection last(int elements)
elements - number of elements 1..N@CheckReturnValue public int size()
size in interface java.util.Collection<SelenideElement>size in interface java.util.List<SelenideElement>size in class java.util.AbstractCollection<SelenideElement>@CheckReturnValue @Nonnull 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>@CheckReturnValue @Nonnull public java.util.ListIterator<SelenideElement> listIterator(int index)
listIterator in interface java.util.List<SelenideElement>listIterator in class java.util.AbstractList<SelenideElement>@CheckReturnValue @Nonnull 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>@CheckReturnValue @Nonnull public ElementsCollection snapshot()
@CheckReturnValue @Nonnull public ElementsCollection as(java.lang.String alias)
alias - a human-readable name of this collection (null or empty string not allowed)@CheckReturnValue public java.lang.String toString()
toString in class java.util.AbstractCollection<SelenideElement>