java.lang.Object
net.serenitybdd.screenplay.playwright.questions.CSSClasses
All Implemented Interfaces:
net.serenitybdd.screenplay.Question<List<String>>

public class CSSClasses extends Object implements net.serenitybdd.screenplay.Question<List<String>>
Get CSS classes of an element or check if it has a specific class.

Sample usage:

     List<String> classes = actor.asksFor(CSSClasses.of("#element"));
     Boolean hasClass = actor.asksFor(CSSClasses.of("#element").contains("active"));
 
  • Method Summary

    Modifier and Type
    Method
    Description
    answeredBy(net.serenitybdd.screenplay.Actor actor)
     
    net.serenitybdd.screenplay.Question<Boolean>
    contains(String className)
    Check if the element has a specific class.
    static CSSClasses
    of(String selector)
    Get CSS classes for an element identified by a selector.
    static CSSClasses
    of(Target target)
    Get CSS classes for a Target element.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.serenitybdd.screenplay.Question

    as, asADate, asADate, asBigDecimal, asBoolean, asCollectionOf, asDouble, asEnum, asFloat, asInteger, asListOf, asLong, asString, describedAs, getSubject, map, mapEach
  • Method Details

    • of

      public static CSSClasses of(String selector)
      Get CSS classes for an element identified by a selector.
    • of

      public static CSSClasses of(Target target)
      Get CSS classes for a Target element.
    • contains

      public net.serenitybdd.screenplay.Question<Boolean> contains(String className)
      Check if the element has a specific class.
    • answeredBy

      public List<String> answeredBy(net.serenitybdd.screenplay.Actor actor)
      Specified by:
      answeredBy in interface net.serenitybdd.screenplay.Question<List<String>>
    • toString

      public String toString()
      Overrides:
      toString in class Object