Package com.codeborne.selenide
Class CollectionCondition
java.lang.Object
com.codeborne.selenide.CollectionCondition
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic WebElementsCondition
Checks if ALL elements of this collection match the provided predicatestatic WebElementsCondition
Checks if ANY elements of this collection match the provided predicatestatic WebElementsCondition
attributes
(String attribute, String... expectedValues) static WebElementsCondition
attributes
(String attribute, List<String> expectedValues) Checks that given collection has given attribute values (each collection element EQUALS TO corresponding attribute value)static WebElementsCondition
containExactTextsCaseSensitive
(String... expectedTexts) Check that the given collection contains all elements with given texts.static WebElementsCondition
containExactTextsCaseSensitive
(List<String> expectedTexts) Check that the given collection contains all elements with given texts.static WebElementsCondition
exactTexts
(String... expectedTexts) Checks that given collection has given texts (each collection element EQUALS TO corresponding text)static WebElementsCondition
exactTexts
(List<String> expectedTexts) Checks that given collection has given texts (each collection element EQUALS TO corresponding text)static WebElementsCondition
exactTextsCaseSensitive
(String... expectedTexts) Checks that given collection has given case-sensitive texts (each collection element EQUALS TO CASE SENSITIVE corresponding text)static WebElementsCondition
exactTextsCaseSensitive
(List<String> expectedTexts) Checks that given collection has given case-sensitive texts (each collection element EQUALS TO CASE SENSITIVE corresponding text)static WebElementsCondition
exactTextsCaseSensitiveInAnyOrder
(String... expectedTexts) Checks that given collection has given texts in any order (each collection element EQUALS TO corresponding text)static WebElementsCondition
exactTextsCaseSensitiveInAnyOrder
(List<String> expectedTexts) Checks that given collection has given texts in any order (each collection element EQUALS TO corresponding text)static WebElementsCondition
itemWithText
(String expectedText) Checks if given collection has an element with given text.static WebElementsCondition
Checks if NONE elements of this collection match the provided predicatestatic WebElementsCondition
size
(int expectedSize) Checks that collection has the given sizestatic WebElementsCondition
sizeGreaterThan
(int expectedSize) static WebElementsCondition
sizeGreaterThanOrEqual
(int expectedSize) static WebElementsCondition
sizeLessThan
(int expectedSize) static WebElementsCondition
sizeLessThanOrEqual
(int size) static WebElementsCondition
sizeNotEqual
(int expectedSize) static WebElementsCondition
Checks that given collection has given texts (each collection element CONTAINS corresponding text)static WebElementsCondition
Checks that given collection has given texts (each collection element CONTAINS corresponding text)static WebElementsCondition
textsInAnyOrder
(String... expectedTexts) Checks that given collection has given texts in any order (each collection element CONTAINS corresponding text)static WebElementsCondition
textsInAnyOrder
(List<String> expectedTexts) Checks that given collection has given texts in any order (each collection element CONTAINS corresponding text)
-
Field Details
-
empty
-
-
Constructor Details
-
CollectionCondition
public CollectionCondition()
-
-
Method Details
-
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
-
attributes
@CheckReturnValue public static WebElementsCondition attributes(String attribute, String... expectedValues) - See Also:
-
attributes
@CheckReturnValue public static WebElementsCondition attributes(String attribute, List<String> expectedValues) Checks that given collection has given attribute values (each collection element EQUALS TO corresponding attribute value)NB! Ignores multiple whitespaces between words
-
exactTextsCaseSensitive
@CheckReturnValue public static WebElementsCondition 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 WebElementsCondition 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 WebElementsCondition 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
- thePredicate
to match
-
allMatch
@CheckReturnValue public static WebElementsCondition 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
- thePredicate
to match
-
noneMatch
@CheckReturnValue public static WebElementsCondition 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
- thePredicate
to 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 WebElementsCondition 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 WebElementsCondition 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 WebElementsCondition 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 WebElementsCondition 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
-