Interface ElementAttributeAssert
- All Superinterfaces:
AttributeAssert<org.assertj.core.api.AbstractStringAssert>
- All Known Implementing Classes:
FluentWebElementAssert
-
Method Summary
Modifier and TypeMethodDescriptionorg.assertj.core.api.AbstractStringAssert
hasAttribute
(String attribute) Checks if the element has the given property.Methods inherited from interface io.fluentlenium.assertj.custom.AttributeAssert
hasNotAttribute
-
Method Details
-
hasAttribute
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>
- Parameters:
attribute
- the attribute to find- Returns:
- a new
AbstractStringAssert
object with the actual attribute value
-