@ParametersAreNonnullByDefault
public abstract class CollectionCondition
extends java.lang.Object
implements java.util.function.Predicate<java.util.List<org.openqa.selenium.WebElement>>
| Modifier and Type | Field and Description |
|---|---|
static CollectionCondition |
empty |
protected java.lang.String |
explanation |
| Constructor and Description |
|---|
CollectionCondition() |
| Modifier and Type | Method and Description |
|---|---|
static CollectionCondition |
allMatch(java.lang.String description,
java.util.function.Predicate<org.openqa.selenium.WebElement> predicate)
Checks if ALL elements of this collection match the provided predicate
|
static CollectionCondition |
anyMatch(java.lang.String description,
java.util.function.Predicate<org.openqa.selenium.WebElement> predicate)
Checks if ANY elements of this collection match the provided predicate
|
CollectionCondition |
because(java.lang.String explanation)
Should be used for explaining the reason of condition
|
static CollectionCondition |
containExactTextsCaseSensitive(java.util.List<java.lang.String> expectedTexts)
Check that the given collection contains all elements with given texts.
|
static CollectionCondition |
containExactTextsCaseSensitive(java.lang.String... expectedTexts)
Check that the given collection contains all elements with given texts.
|
static CollectionCondition |
exactTexts(java.util.List<java.lang.String> expectedTexts)
Checks that given collection has given texts (each collection element EQUALS TO corresponding text)
|
static CollectionCondition |
exactTexts(java.lang.String... expectedTexts)
Checks that given collection has given texts (each collection element EQUALS TO corresponding text)
|
static CollectionCondition |
exactTextsCaseSensitiveInAnyOrder(java.util.List<java.lang.String> expectedTexts)
Checks that given collection has given texts in any order (each collection element EQUALS TO corresponding text)
|
static CollectionCondition |
exactTextsCaseSensitiveInAnyOrder(java.lang.String... expectedTexts)
Checks that given collection has given texts in any order (each collection element EQUALS TO corresponding text)
|
abstract void |
fail(CollectionSource collection,
java.util.List<org.openqa.selenium.WebElement> elements,
java.lang.Exception lastError,
long timeoutMs) |
static CollectionCondition |
itemWithText(java.lang.String expectedText)
Checks if given collection has an element with given text.
|
abstract boolean |
missingElementSatisfiesCondition() |
static CollectionCondition |
noneMatch(java.lang.String description,
java.util.function.Predicate<org.openqa.selenium.WebElement> predicate)
Checks if NONE elements of this collection match the provided predicate
|
static CollectionCondition |
size(int expectedSize)
Checks that collection has the given size
|
static CollectionCondition |
sizeGreaterThan(int expectedSize) |
static CollectionCondition |
sizeGreaterThanOrEqual(int expectedSize) |
static CollectionCondition |
sizeLessThan(int expectedSize) |
static CollectionCondition |
sizeLessThanOrEqual(int size) |
static CollectionCondition |
sizeNotEqual(int expectedSize) |
static CollectionCondition |
texts(java.util.List<java.lang.String> expectedTexts)
Checks that given collection has given texts (each collection element CONTAINS corresponding text)
|
static CollectionCondition |
texts(java.lang.String... expectedTexts)
Checks that given collection has given texts (each collection element CONTAINS corresponding text)
|
static CollectionCondition |
textsInAnyOrder(java.util.List<java.lang.String> expectedTexts)
Checks that given collection has given texts in any order (each collection element CONTAINS corresponding text)
|
static CollectionCondition |
textsInAnyOrder(java.lang.String... expectedTexts)
Checks that given collection has given texts in any order (each collection element CONTAINS corresponding text)
|
protected java.lang.String explanation
public static CollectionCondition empty
public abstract void fail(CollectionSource collection, @Nullable java.util.List<org.openqa.selenium.WebElement> elements, @Nullable java.lang.Exception lastError, long timeoutMs)
@CheckReturnValue public static CollectionCondition size(int expectedSize)
@CheckReturnValue public static CollectionCondition sizeGreaterThan(int expectedSize)
@CheckReturnValue public static CollectionCondition sizeGreaterThanOrEqual(int expectedSize)
@CheckReturnValue public static CollectionCondition sizeLessThan(int expectedSize)
@CheckReturnValue public static CollectionCondition sizeLessThanOrEqual(int size)
@CheckReturnValue public static CollectionCondition sizeNotEqual(int expectedSize)
@CheckReturnValue public static CollectionCondition texts(java.lang.String... expectedTexts)
NB! Ignores multiple whitespaces between words
@CheckReturnValue public static CollectionCondition texts(java.util.List<java.lang.String> expectedTexts)
NB! Ignores multiple whitespaces between words
@CheckReturnValue public static CollectionCondition textsInAnyOrder(java.lang.String... expectedTexts)
NB! Ignores multiple whitespaces between words
@CheckReturnValue public static CollectionCondition textsInAnyOrder(java.util.List<java.lang.String> expectedTexts)
NB! Ignores multiple whitespaces between words
@CheckReturnValue public static CollectionCondition exactTexts(java.lang.String... expectedTexts)
NB! Ignores multiple whitespaces between words
@CheckReturnValue public static CollectionCondition exactTexts(java.util.List<java.lang.String> expectedTexts)
NB! Ignores multiple whitespaces between words
@CheckReturnValue public static CollectionCondition anyMatch(java.lang.String description, java.util.function.Predicate<org.openqa.selenium.WebElement> predicate)
description - The description of the given predicatepredicate - the Predicate to match@CheckReturnValue public static CollectionCondition allMatch(java.lang.String description, java.util.function.Predicate<org.openqa.selenium.WebElement> predicate)
description - The description of the given predicatepredicate - the Predicate to match@CheckReturnValue public static CollectionCondition noneMatch(java.lang.String description, java.util.function.Predicate<org.openqa.selenium.WebElement> predicate)
description - The description of the given predicatepredicate - the Predicate to match@CheckReturnValue public static CollectionCondition itemWithText(java.lang.String expectedText)
expectedText - The expected text in the collection@CheckReturnValue public static CollectionCondition containExactTextsCaseSensitive(java.lang.String... expectedTexts)
NB! This condition is case-sensitive and checks for exact matches!
Examples:
// collection 1: [Tom, Dick, Harry]
$$("li.odd").should(containExactTextsCaseSensitive("Tom", "Dick", "Harry")); // success
// collection 2: [Tom, John, Dick, Harry]
$$("li.even").should(containExactTextsCaseSensitive("Tom", "Dick", "Harry")); // success
// collection 3: [John, Dick, Tom, Paul]
$$("li.first").should(containExactTextsCaseSensitive("Tom", "Dick", "Harry")); // fail ("Harry" is missing)
// collection 4: [Tom, Dick, hArRy]
$$("li.last").should(containExactTextsCaseSensitive("Tom", "Dick", "Harry")); // fail ("Harry" is missing)
expectedTexts - the expected texts that the collection should contain@CheckReturnValue public static CollectionCondition containExactTextsCaseSensitive(java.util.List<java.lang.String> expectedTexts)
NB! This condition is case-sensitive and checks for exact matches!
Examples:
// collection 1: [Tom, Dick, Harry]
$$("li.odd").should(containExactTextsCaseSensitive("Tom", "Dick", "Harry")); // success
// collection 2: [Tom, John, Dick, Harry]
$$("li.even").should(containExactTextsCaseSensitive("Tom", "Dick", "Harry")); // success
// collection 3: [John, Dick, Tom, Paul]
$$("li.first").should(containExactTextsCaseSensitive("Tom", "Dick", "Harry")); // fail ("Harry" is missing)
// collection 4: [Tom, Dick, hArRy]
$$("li.last").should(containExactTextsCaseSensitive("Tom", "Dick", "Harry")); // fail ("Harry" is missing)
expectedTexts - the expected texts that the collection should contain@CheckReturnValue public static CollectionCondition exactTextsCaseSensitiveInAnyOrder(java.util.List<java.lang.String> expectedTexts)
NB! Case sensitive
expectedTexts - Expected texts in any order in the collection@CheckReturnValue public static CollectionCondition exactTextsCaseSensitiveInAnyOrder(java.lang.String... expectedTexts)
NB! Case sensitive
expectedTexts - Expected texts in any order in the collectionpublic CollectionCondition because(java.lang.String explanation)
public abstract boolean missingElementSatisfiesCondition()