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

public class Dropdown extends Object
Factory for locating dropdown (select) elements using Playwright selectors.

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

Sample usage:

     Target countryDropdown = Dropdown.withLabel("Country");
     Target stateDropdown = Dropdown.withNameOrId("state");
 
  • Method Details

    • withLabel

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

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

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