java.lang.Object
net.serenitybdd.screenplay.playwright.ui.Checkbox

public class Checkbox extends Object
Factory for locating checkbox elements using Playwright selectors.

Uses Playwright's role selectors for accessibility-aware checkbox location.

Sample usage:

     Target termsCheckbox = Checkbox.withLabel("I agree to the terms");
     Target rememberMe = Checkbox.withNameOrId("remember-me");
     Target optionA = Checkbox.withValue("option-a");
 
  • Method Details

    • withLabel

      public static Target withLabel(String label)
      Locate a checkbox by its label text (case-insensitive). Uses Playwright's role selector for semantic checkbox matching.
      Parameters:
      label - The checkbox's label or accessible name
      Returns:
      A Target for the checkbox element
    • withNameOrId

      public static Target withNameOrId(String name)
      Locate a checkbox by its name attribute, id, or data-test attribute.
      Parameters:
      name - The name, id, or data-test value
      Returns:
      A Target for the checkbox element
    • withValue

      public static Target withValue(String value)
      Locate a checkbox by its value attribute.
      Parameters:
      value - The value attribute
      Returns:
      A Target for the checkbox element
    • locatedBy

      public static Target locatedBy(String selector)
      Locate a checkbox using a custom Playwright selector.
      Parameters:
      selector - A valid Playwright selector
      Returns:
      A Target for the checkbox element