Interface ElementAttributeAssert

All Superinterfaces:
AttributeAssert<org.assertj.core.api.AbstractStringAssert>
All Known Implementing Classes:
FluentWebElementAssert

public interface ElementAttributeAssert extends AttributeAssert<org.assertj.core.api.AbstractStringAssert>
Assertion interface for element attribute validation.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.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

      org.assertj.core.api.AbstractStringAssert hasAttribute (String attribute)
      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 interface AttributeAssert<org.assertj.core.api.AbstractStringAssert>
      Parameters:
      attribute - the attribute to find
      Returns:
      a new AbstractStringAssert object with the actual attribute value