Class Dropdown
java.lang.Object
net.serenitybdd.screenplay.playwright.ui.Dropdown
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 Summary
Modifier and TypeMethodDescriptionstatic TargetLocate a dropdown using a custom Playwright selector.static TargetLocate a dropdown by its label text (case-insensitive).static TargetwithNameOrId(String name) Locate a dropdown by its name attribute, id, or data-test attribute.
-
Method Details
-
withLabel
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
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
Locate a dropdown using a custom Playwright selector.- Parameters:
selector- A valid Playwright selector- Returns:
- A Target for the dropdown element
-