Package com.codeborne.selenide
Class CollectionCondition
java.lang.Object
com.codeborne.selenide.CollectionCondition
- Direct Known Subclasses:
ContainExactTextsCaseSensitive,ExactTexts,ItemWithText,ListSize,PredicateCollectionCondition,SizeGreaterThan,SizeGreaterThanOrEqual,SizeLessThan,SizeLessThanOrEqual,SizeNotEqual
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CollectionConditionChecks if ALL elements of this collection match the provided predicatestatic CollectionConditionChecks if ANY elements of this collection match the provided predicateShould be used for explaining the reason of conditionstatic CollectionConditioncontainExactTextsCaseSensitive(String... expectedTexts) Check that the given collection contains all elements with given texts.static CollectionConditioncontainExactTextsCaseSensitive(List<String> expectedTexts) Check that the given collection contains all elements with given texts.static CollectionConditionexactTexts(String... expectedTexts) Checks that given collection has given texts (each collection element EQUALS TO corresponding text)static CollectionConditionexactTexts(List<String> expectedTexts) Checks that given collection has given texts (each collection element EQUALS TO corresponding text)static CollectionConditionexactTextsCaseSensitive(String... expectedTexts) Checks that given collection has given case-sensitive texts (each collection element EQUALS TO CASE SENSITIVE corresponding text)static CollectionConditionexactTextsCaseSensitive(List<String> expectedTexts) Checks that given collection has given case-sensitive texts (each collection element EQUALS TO CASE SENSITIVE corresponding text)static CollectionConditionexactTextsCaseSensitiveInAnyOrder(String... expectedTexts) Checks that given collection has given texts in any order (each collection element EQUALS TO corresponding text)static CollectionConditionexactTextsCaseSensitiveInAnyOrder(List<String> expectedTexts) Checks that given collection has given texts in any order (each collection element EQUALS TO corresponding text)abstract voidfail(CollectionSource collection, List<org.openqa.selenium.WebElement> elements, Exception lastError, long timeoutMs) static CollectionConditionitemWithText(String expectedText) Checks if given collection has an element with given text.abstract booleanstatic CollectionConditionChecks if NONE elements of this collection match the provided predicatestatic CollectionConditionsize(int expectedSize) Checks that collection has the given sizestatic CollectionConditionsizeGreaterThan(int expectedSize) static CollectionConditionsizeGreaterThanOrEqual(int expectedSize) static CollectionConditionsizeLessThan(int expectedSize) static CollectionConditionsizeLessThanOrEqual(int size) static CollectionConditionsizeNotEqual(int expectedSize) static CollectionConditionChecks that given collection has given texts (each collection element CONTAINS corresponding text)static CollectionConditionChecks that given collection has given texts (each collection element CONTAINS corresponding text)static CollectionConditiontextsInAnyOrder(String... expectedTexts) Checks that given collection has given texts in any order (each collection element CONTAINS corresponding text)static CollectionConditiontextsInAnyOrder(List<String> expectedTexts) Checks that given collection has given texts in any order (each collection element CONTAINS corresponding text)
-
Field Details
-
explanation
-
empty
-
-
Constructor Details
-
CollectionCondition
public CollectionCondition()
-
-
Method Details
-
fail
public abstract void fail(CollectionSource collection, @Nullable List<org.openqa.selenium.WebElement> elements, @Nullable Exception lastError, long timeoutMs) -
size
Checks that collection has the given size -
sizeGreaterThan
-
sizeGreaterThanOrEqual
-
sizeLessThan
-
sizeLessThanOrEqual
-
sizeNotEqual
-
texts
Checks that given collection has given texts (each collection element CONTAINS corresponding text)NB! Ignores multiple whitespaces between words
-
texts
Checks that given collection has given texts (each collection element CONTAINS corresponding text)NB! Ignores multiple whitespaces between words
-
textsInAnyOrder
Checks that given collection has given texts in any order (each collection element CONTAINS corresponding text)NB! Ignores multiple whitespaces between words
-
textsInAnyOrder
Checks that given collection has given texts in any order (each collection element CONTAINS corresponding text)NB! Ignores multiple whitespaces between words
-
exactTexts
Checks that given collection has given texts (each collection element EQUALS TO corresponding text)NB! Ignores multiple whitespaces between words
-
exactTexts
Checks that given collection has given texts (each collection element EQUALS TO corresponding text)NB! Ignores multiple whitespaces between words
-
exactTextsCaseSensitive
@CheckReturnValue public static CollectionCondition exactTextsCaseSensitive(String... expectedTexts) Checks that given collection has given case-sensitive texts (each collection element EQUALS TO CASE SENSITIVE corresponding text)NB! Ignores multiple whitespaces between words
-
exactTextsCaseSensitive
@CheckReturnValue public static CollectionCondition exactTextsCaseSensitive(List<String> expectedTexts) Checks that given collection has given case-sensitive texts (each collection element EQUALS TO CASE SENSITIVE corresponding text)NB! Ignores multiple whitespaces between words
-
anyMatch
@CheckReturnValue public static CollectionCondition anyMatch(String description, Predicate<org.openqa.selenium.WebElement> predicate) Checks if ANY elements of this collection match the provided predicate- Parameters:
description- The description of the given predicatepredicate- thePredicateto match
-
allMatch
@CheckReturnValue public static CollectionCondition allMatch(String description, Predicate<org.openqa.selenium.WebElement> predicate) Checks if ALL elements of this collection match the provided predicate- Parameters:
description- The description of the given predicatepredicate- thePredicateto match
-
noneMatch
@CheckReturnValue public static CollectionCondition noneMatch(String description, Predicate<org.openqa.selenium.WebElement> predicate) Checks if NONE elements of this collection match the provided predicate- Parameters:
description- The description of the given predicatepredicate- thePredicateto match
-
itemWithText
Checks if given collection has an element with given text. The condition is satisfied if one or more elements in this collection have exactly the given text.- Parameters:
expectedText- The expected text in the collection
-
containExactTextsCaseSensitive
@CheckReturnValue public static CollectionCondition containExactTextsCaseSensitive(String... expectedTexts) Check that the given collection contains all elements with given texts.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)- Parameters:
expectedTexts- the expected texts that the collection should contain
-
containExactTextsCaseSensitive
@CheckReturnValue public static CollectionCondition containExactTextsCaseSensitive(List<String> expectedTexts) Check that the given collection contains all elements with given texts.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)- Parameters:
expectedTexts- the expected texts that the collection should contain
-
exactTextsCaseSensitiveInAnyOrder
@CheckReturnValue public static CollectionCondition exactTextsCaseSensitiveInAnyOrder(List<String> expectedTexts) Checks that given collection has given texts in any order (each collection element EQUALS TO corresponding text)NB! Case sensitive
- Parameters:
expectedTexts- Expected texts in any order in the collection
-
exactTextsCaseSensitiveInAnyOrder
@CheckReturnValue public static CollectionCondition exactTextsCaseSensitiveInAnyOrder(String... expectedTexts) Checks that given collection has given texts in any order (each collection element EQUALS TO corresponding text)NB! Case sensitive
- Parameters:
expectedTexts- Expected texts in any order in the collection
-
because
Should be used for explaining the reason of condition -
missingElementSatisfiesCondition
public abstract boolean missingElementSatisfiesCondition()
-