Package 

Class ElementConditions

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static <T extends Component> Predicate<T> containsText(String text) Checks if text content of the component contains the given text.
      static <T extends Component> Predicate<T> containsText(String text, boolean ignoreCase) Checks if text content of the component contains the given text.
      static <T extends Component> Predicate<T> hasAttribute(String attribute) Checks if the given attribute has been set on the component.
      static <T extends Component> Predicate<T> hasAttribute(String attribute, String value) Checks if the given attribute has been set on the component and has exactly the given value.
      static <T extends Component> Predicate<T> hasNotAttribute(String attribute) Checks if the given attribute has not been set on the component.
      static <T extends Component> Predicate<T> hasNotAttribute(String attribute, String value) Checks if the given attribute has been set on the component or has a value different from given one.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • containsText

         static <T extends Component> Predicate<T> containsText(String text)

        Checks if text content of the component contains the given text. Input text is compared with value obtained either by getText, getText if element is a text node, or the normalized version of getInnerHtml. In all other cases getTextRecursively is used, but in this case text from nested elements is concatenated without space separators. The comparison is case-sensitive. For Html components the innerHTML tags are stripped and whitespace is normalized and trimmed. For example, given HTML

        the text that will be checked will be Hello there now!.
        Parameters:
        text - the text the component is expected to have as its content.
      • containsText

         static <T extends Component> Predicate<T> containsText(String text, boolean ignoreCase)

        Checks if text content of the component contains the given text. Input text is compared with value obtained either by getText, getText if element is a text node, or getInnerHtml. In all other cases getTextRecursively is used, but in this case text from nested elements is concatenated without space separators. For Html components the innerHTML tags are stripped and whitespace is normalized and trimmed. For example, given HTML

        the text that will be checked will be Hello there now!.
        Parameters:
        text - the text the component is expected to have as its content.
        ignoreCase - flag to indicate if comparison must be case-insensitive.
      • hasAttribute

         static <T extends Component> Predicate<T> hasAttribute(String attribute)

        Checks if the given attribute has been set on the component. Attribute names are considered case-insensitive and all names will be converted to lower case automatically.

        Parameters:
        attribute - the name of the attribute, not null
      • hasAttribute

         static <T extends Component> Predicate<T> hasAttribute(String attribute, String value)

        Checks if the given attribute has been set on the component and has exactly the given value. Attribute names are considered case-insensitive and all names will be converted to lower case automatically.

        Parameters:
        attribute - the name of the attribute, not null
        value - expected value, not null
      • hasNotAttribute

         static <T extends Component> Predicate<T> hasNotAttribute(String attribute)

        Checks if the given attribute has not been set on the component. Attribute names are considered case-insensitive and all names will be converted to lower case automatically.

        Parameters:
        attribute - the name of the attribute, not null
      • hasNotAttribute

         static <T extends Component> Predicate<T> hasNotAttribute(String attribute, String value)

        Checks if the given attribute has been set on the component or has a value different from given one. Attribute names are considered case-insensitive and all names will be converted to lower case automatically.

        Parameters:
        attribute - the name of the attribute, not null
        value - value expected not to be set on attribute, not null