Class FluentWebElementAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<FluentWebElementAssert,
,FluentWebElement> org.assertj.core.api.Descriptable<FluentWebElementAssert>
,org.assertj.core.api.ExtensionPoints<FluentWebElementAssert,
,FluentWebElement> AttributeAssert<org.assertj.core.api.AbstractStringAssert>
,ElementAttributeAssert
,ElementStateAssert
,FluentAssert
FluentWebElement
assertions.
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.assertj.core.api.AbstractStringAssert
hasAttribute
(String attribute) Checks if the element has the given property.hasAttributeValue
(String attribute, String value) Checks if the element, or at least one element in a list of elements, has property with the exact given value.Checks if the element, or at least one element in a list of elements, has the class.hasClasses
(String... classesToFind) Checks if the element, or at least one element in a list of elements, has all of the argument classes.hasDimension
(org.openqa.selenium.Dimension dimension) Checks if the element, or at least one element in a list of elements, has given dimension.Checks if the element, or at least one element in a list of elements, has the given idChecks if the element, or at least one element in a list of elements, has given name (in its 'name' attribute).hasNotAttribute
(String attribute) Checks if the element doesn't have, or no element in a list of elements has, the given property.hasNotClass
(String htmlClass) Checks if the element does not contain, or none of the elements in a list of elements contain the classhasNotClasses
(String... classesToFind) Checks if the element does not contain, or none of the elements in a list of elements contain any of the classes.hasNotText
(String textToFind) Checks if the element does not contain, or none of the elements in a list of elements contain the text.hasNotTextContaining
(String textToFind) Checks if the element does not contain, or none of the elements in a list of elements contain the text.hasTagName
(String tagName) Checks if the element, or at least one element in a list of elements, has given tag.Checks if the element, or at least one element in a list of elements, contain the text.hasTextContaining
(String text) Checks if the element, or at least one element in a list of elements, contain the text.hasTextMatching
(String regexToBeMatched) Checks if the element, or at least one element in a list of elements, matches the given regex.Checks if the element, or at least one element in a list of elements has given value (in its 'value' attribute).Checks if the element is clickable.Checks if the element is displayed.Checks if the element is enabled.Checks if the element is not clickable.Checks if the element is not displayed.Checks if the element is not enabled.Checks if the element is not present.Checks if the element is not selected.Checks if the element is present.Checks if the element is selected.Methods inherited from class org.assertj.core.api.AbstractAssert
areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as, as, as, describedAs
-
Constructor Details
-
FluentWebElementAssert
-
-
Method Details
-
isEnabled
Description copied from interface:ElementStateAssert
Checks if the element is enabled.This method also has a preceding validation for the presence of the element, which fails this assertion method if it would fail.
Example:
assertThat(element).isEnabled();
- Specified by:
isEnabled
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
isNotEnabled
Description copied from interface:ElementStateAssert
Checks if the element is not enabled.This method also has a preceding validation for the presence of the element, which fails this assertion method if it would fail.
Example:
assertThat(element).isNotEnabled();
- Specified by:
isNotEnabled
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
isDisplayed
Description copied from interface:ElementStateAssert
Checks if the element is displayed.This method also has a preceding validation for the presence of the element, which fails this assertion method if it would fail.
Example:
assertThat(element).isDisplayed();
- Specified by:
isDisplayed
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
isNotDisplayed
Description copied from interface:ElementStateAssert
Checks if the element is not displayed.This method also has a preceding validation for the presence of the element, which fails this assertion method if it would fail.
Example:
assertThat(element).isNotDisplayed();
- Specified by:
isNotDisplayed
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
isSelected
Description copied from interface:ElementStateAssert
Checks if the element is selected.This method also has a preceding validation for the presence of the element, which fails this assertion method if it would fail.
Example:
assertThat(element).isSelected();
- Specified by:
isSelected
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
isNotSelected
Description copied from interface:ElementStateAssert
Checks if the element is not selected.This method also has a preceding validation for the presence of the element, which fails this assertion method if it would fail.
Example:
assertThat(element).isNotSelected();
- Specified by:
isNotSelected
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
isClickable
Description copied from interface:ElementStateAssert
Checks if the element is clickable.This method also has a preceding validation for the presence of the element, which fails this assertion method if it would fail.
Example:
assertThat(element).isClickable();
- Specified by:
isClickable
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
isNotClickable
Description copied from interface:ElementStateAssert
Checks if the element is not clickable.This method also has a preceding validation for the presence of the element, which fails this assertion method if it would fail.
Example:
assertThat(element).isNotClickable();
- Specified by:
isNotClickable
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
isPresent
Description copied from interface:ElementStateAssert
Checks if the element is present.Example:
assertThat(element).isPresent();
- Specified by:
isPresent
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
isNotPresent
Description copied from interface:ElementStateAssert
Checks if the element is not present.Example:
assertThat(element).isNotPresent();
- Specified by:
isNotPresent
in interfaceElementStateAssert
- Returns:
this
assertion object.
-
hasText
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, contain the text.Example:
For a
FluentWebElement
it can be:assertThat(element).hasText("magnificent");
which passes when the element contains (but is not necessarily exactly equal to) the argument text.NOTE: currently both this method and
FluentAssert.hasTextContaining(String)
validate text containment. If you want to validate containment please useFluentAssert.hasTextContaining(String)
, as this method will be updated in a future release to validate equality of text(s).- Specified by:
hasText
in interfaceFluentAssert
- Parameters:
textToFind
- text to find- Returns:
this
assertion object.
-
hasTextContaining
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, contain the text.Example:
For a
FluentWebElement
it can be:assertThat(element).hasTextContaining("magnificent");
which passes when the element contains (but is not necessarily exactly equal to) the argument text.NOTE: currently both
FluentAssert.hasText(String)
and this method validate text containment. If you want to validate containment please use this method, asFluentAssert.hasText(String)
will be updated in a future release to validate equality of text(s).- Specified by:
hasTextContaining
in interfaceFluentAssert
- Parameters:
text
- text to find- Returns:
this
assertion object.
-
hasTextMatching
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, matches the given regex.Example:
For a
FluentWebElement
it can be:assertThat(element).hasTextMatching(".*magnificent$");
- Specified by:
hasTextMatching
in interfaceFluentAssert
- Parameters:
regexToBeMatched
- regex to be matched- Returns:
this
assertion object.
-
hasNotText
Description copied from interface:FluentAssert
Checks if the element does not contain, or none of the elements in a list of elements contain the text.Example:
For a
FluentWebElement
it can be:assertThat(element).hasNotText("magnificent");
which passes when the element text doesn't contains (and not when it is not equal to) to the argument text.NOTE: currently both this method and
FluentAssert.hasNotTextContaining(String)
validate text containment. If you want to validate containment please useFluentAssert.hasNotTextContaining(String)
, as this method will be updated in a future release to validate equality of text(s).- Specified by:
hasNotText
in interfaceFluentAssert
- Parameters:
textToFind
- text to find- Returns:
this
assertion object.
-
hasNotTextContaining
Description copied from interface:FluentAssert
Checks if the element does not contain, or none of the elements in a list of elements contain the text.Example:
For a
FluentWebElement
it can be:assertThat(element).hasNotText("magnificent");
which passes when the element text doesn't contains (and not when it is not equal to) to the argument text.NOTE: currently both
FluentAssert.hasNotText(String)
and this method validate text containment. If you want to validate containment please use this method, asFluentAssert.hasNotText(String)
will be updated in a future release to validate equality of text(s).- Specified by:
hasNotTextContaining
in interfaceFluentAssert
- Parameters:
textToFind
- text to find- Returns:
this
assertion object.
-
hasId
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has the given idExample:
For a
FluentWebElement
it can be:assertThat(element).hasId("marked");
which passes when the element text is equal to the argumentidToFind
.- Specified by:
hasId
in interfaceFluentAssert
- Parameters:
idToFind
- id to find- Returns:
this
assertion object.
-
hasClass
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has the class.Example:
For a
FluentWebElement
it can be:assertThat(element).hasClass("marked");
which passes when the element class attribute (handled as a list of class values) contains the argumentclassToFind
.- Specified by:
hasClass
in interfaceFluentAssert
- Parameters:
classToFind
- class to find- Returns:
this
assertion object.
-
hasNotClass
Description copied from interface:FluentAssert
Checks if the element does not contain, or none of the elements in a list of elements contain the classIt passes assertion both when the class attribute is present but doesn't contain the argument class, and when the class attribute is not present at all.
Example:
For a
FluentWebElement
it can be:assertThat(element).hasNotClass("marked");
- Specified by:
hasNotClass
in interfaceFluentAssert
- Parameters:
htmlClass
- class to find the absence of- Returns:
this
assertion object.
-
hasClasses
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has all of the argument classes.Example:
For a
FluentWebElement
it can be:assertThat(element).hasClasses("marked", "as", "great");
which passes when the element class attribute (handled as a list of class values) contains all of the argumentclassesToFind
.- Specified by:
hasClasses
in interfaceFluentAssert
- Parameters:
classesToFind
- classes to find- Returns:
this
assertion object.
-
hasNotClasses
Description copied from interface:FluentAssert
Checks if the element does not contain, or none of the elements in a list of elements contain any of the classes.Example:
For a
FluentWebElement
it can be:assertThat(element).hasNotClasses("marked", "as", "great");
- Specified by:
hasNotClasses
in interfaceFluentAssert
- Parameters:
classesToFind
- classes to find the absence of- Returns:
this
assertion object.
-
hasValue
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements has given value (in its 'value' attribute).Example:
For a
FluentWebElement
it can be:assertThat(element).hasValue("John Smith");
which passes when the element's value is equal to the argument value.- Specified by:
hasValue
in interfaceFluentAssert
- Parameters:
value
- value to find- Returns:
this
assertion object.
-
hasName
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has given name (in its 'name' attribute).Example:
For a
FluentWebElement
it can be:assertThat(element).hasName("John Smith");
which passes when the element's value is equal to the argument name.- Specified by:
hasName
in interfaceFluentAssert
- Parameters:
name
- name to find- Returns:
this
assertion object.
-
hasTagName
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has given tag.Example:
For a
FluentWebElement
it can be:assertThat(element).hasTagName("div");
which passes when the element's value is equal to the argument tag name.- Specified by:
hasTagName
in interfaceFluentAssert
- Parameters:
tagName
- tag name to find- Returns:
this
assertion object.
-
hasDimension
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has given dimension.Example:
For a
FluentWebElement
it can be:assertThat(element).hasDimension(fluentWebElement.getDimension());
which passes when the element's dimension is equal to the argument dimension.- Specified by:
hasDimension
in interfaceFluentAssert
- Parameters:
dimension
- dimension to find- Returns:
this
assertion object.
-
hasAttributeValue
Description copied from interface:FluentAssert
Checks if the element, or at least one element in a list of elements, has property with the exact given value.Example:
For a
FluentWebElement
it can be:assertThat(element).hasAttributeValue("href", "https://fluentlenium.io");
- Specified by:
hasAttributeValue
in interfaceFluentAssert
- Parameters:
attribute
- attribute to findvalue
- property value to match with actual- Returns:
this
assertion object.
-
hasAttribute
Description copied from interface:ElementAttributeAssert
Checks if the element has the given property.It allows users to do not just presence validation but apply chained String assertions to further validate the attribute value.
Examples:
Validating the presence of an attribute on an element:
assertThat(element).hasAttribute("href");
Validating both the presence of an attribute on an element, and the value of that attribute:
assertThat(element).hasAttribute("href").isEqualTo("https://duckduckgo.com");
- Specified by:
hasAttribute
in interfaceAttributeAssert<org.assertj.core.api.AbstractStringAssert>
- Specified by:
hasAttribute
in interfaceElementAttributeAssert
- Parameters:
attribute
- the attribute to find- Returns:
- a new
AbstractStringAssert
object with the actual attribute value
-
hasNotAttribute
Description copied from interface:AttributeAssert
Checks if the element doesn't have, or no element in a list of elements has, the given property.- Specified by:
hasNotAttribute
in interfaceAttributeAssert<org.assertj.core.api.AbstractStringAssert>
- Parameters:
attribute
- attribute to find the absence of- Returns:
this
assertion object.
-