Interface FluentAssert

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.assertj.core.api.AbstractAssert 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.
      org.assertj.core.api.AbstractAssert hasClass​(String classToFind)
      Checks if the element, or at least one element in a list of elements, has the class.
      org.assertj.core.api.AbstractAssert hasClasses​(String... classesToFind)
      Checks if the element, or at least one element in a list of elements, has all of the argument classes.
      org.assertj.core.api.AbstractAssert hasDimension​(org.openqa.selenium.Dimension dimension)
      Checks if the element, or at least one element in a list of elements, has given dimension.
      org.assertj.core.api.AbstractAssert hasId​(String idToFind)
      Checks if the element, or at least one element in a list of elements, has the given id
      org.assertj.core.api.AbstractAssert hasName​(String name)
      Checks if the element, or at least one element in a list of elements, has given name (in its 'name' attribute).
      org.assertj.core.api.AbstractAssert hasNotClass​(String htmlClass)
      Checks if the element does not contain, or none of the elements in a list of elements contain the class
      org.assertj.core.api.AbstractAssert hasNotClasses​(String... classesToFind)
      Checks if the element does not contain, or none of the elements in a list of elements contain any of the classes.
      org.assertj.core.api.AbstractAssert hasNotText​(String textToFind)
      Checks if the element does not contain, or none of the elements in a list of elements contain the text.
      org.assertj.core.api.AbstractAssert hasTagName​(String tagName)
      Checks if the element, or at least one element in a list of elements, has given tag.
      org.assertj.core.api.AbstractAssert hasText​(String textToFind)
      Checks if the element, or at least one element in a list of elements, contain the text.
      org.assertj.core.api.AbstractAssert hasTextMatching​(String regexToBeMatched)
      Checks if the element, or at least one element in a list of elements, matches the given regex.
      org.assertj.core.api.AbstractAssert hasValue​(String value)
      Checks if the element, or at least one element in a list of elements has given value (in its 'value' attribute).
    • Method Detail

      • hasText

        org.assertj.core.api.AbstractAssert hasText​(String textToFind)
        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.
        Parameters:
        textToFind - text to find
        Returns:
        this assertion object.
      • hasTextMatching

        org.assertj.core.api.AbstractAssert hasTextMatching​(String regexToBeMatched)
        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$");
         
        Parameters:
        regexToBeMatched - regex to be matched
        Returns:
        this assertion object.
      • hasNotText

        org.assertj.core.api.AbstractAssert hasNotText​(String textToFind)
        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.
        Parameters:
        textToFind - text to find
        Returns:
        this assertion object.
      • hasId

        org.assertj.core.api.AbstractAssert hasId​(String idToFind)
        Checks if the element, or at least one element in a list of elements, has the given id

        Example:

        For a FluentWebElement it can be:

         assertThat(element).hasId("marked");
         
        which passes when the element text is equal to the argument idToFind.
        Parameters:
        idToFind - id to find
        Returns:
        this assertion object.
      • hasClass

        org.assertj.core.api.AbstractAssert hasClass​(String classToFind)
        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 argument classToFind.
        Parameters:
        classToFind - class to find
        Returns:
        this assertion object.
      • hasNotClass

        org.assertj.core.api.AbstractAssert hasNotClass​(String htmlClass)
        Checks if the element does not contain, or none of the elements in a list of elements contain the class

        It 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");
         
        Parameters:
        htmlClass - class to find the absence of
        Returns:
        this assertion object.
      • hasClasses

        org.assertj.core.api.AbstractAssert hasClasses​(String... classesToFind)
        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 argument classesToFind.
        Parameters:
        classesToFind - classes to find
        Returns:
        this assertion object.
      • hasNotClasses

        org.assertj.core.api.AbstractAssert hasNotClasses​(String... classesToFind)
        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");
         
        Parameters:
        classesToFind - classes to find the absence of
        Returns:
        this assertion object.
      • hasValue

        org.assertj.core.api.AbstractAssert hasValue​(String value)
        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.
        Parameters:
        value - value to find
        Returns:
        this assertion object.
      • hasName

        org.assertj.core.api.AbstractAssert hasName​(String name)
        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.
        Parameters:
        name - name to find
        Returns:
        this assertion object.
      • hasTagName

        org.assertj.core.api.AbstractAssert hasTagName​(String tagName)
        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.
        Parameters:
        tagName - tag name to find
        Returns:
        this assertion object.
      • hasAttributeValue

        org.assertj.core.api.AbstractAssert 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.

        Example:

        For a FluentWebElement it can be:

         assertThat(element).hasAttributeValue("href", "https://fluentlenium.com");
         
        Parameters:
        attribute - attribute to find
        value - property value to match with actual
        Returns:
        this assertion object.
      • hasDimension

        org.assertj.core.api.AbstractAssert hasDimension​(org.openqa.selenium.Dimension dimension)
        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.
        Parameters:
        dimension - dimension to find
        Returns:
        this assertion object.