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

public class RadioButton extends Object
Factory for locating radio button elements using Playwright selectors.

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

Sample usage:

     Target yesOption = RadioButton.withLabel("Yes");
     Target genderMale = RadioButton.withNameOrId("gender-male");
     Target optionB = RadioButton.withValue("option-b");
 
  • Method Details

    • withLabel

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

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

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

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