Skip to main content

SelectElement

Playwright element wrapper for <vaadin-select>. Provides helpers to open the overlay and pick items by visible text, along with aria/placeholder/validation mixins.

Component Tag

vaadin-select

Implements

  • FocusableElement
  • HasAriaLabelElement
  • HasInputFieldElement
  • HasPrefixElement
  • HasThemeElement
  • HasPlaceholderElement
  • HasEnabledElement
  • HasTooltipElement
  • HasValidationPropertiesElement

Factory Methods

getByLabel

Get the SelectElement by its label. Uses ARIA role BUTTON.
Page
required
The Playwright page
String
required
The accessible label of the field
Returns: The matching SelectElement

Constructor

SelectElement

Create a new SelectElement.
Locator
required
The locator for the <vaadin-select> element

Methods

selectItem

Select an item by its visible label.
String
required
Label of the item to select

getValue

Get the selected value label for single-select. Returns: The label of the selected value

getAriaLabel

Get the ARIA label text. Returns: The ARIA label or null if not set

assertAriaLabel

Assert the ARIA label text.
String
Expected ARIA label, or null to assert it’s hidden

assertPlaceholder

Assert the placeholder text.
String
required
Expected placeholder text

assertValue

Assert the selected value label equals the expected string.
String
Expected label or empty for no selection

getInputLocator

Get the locator for the value slot element. Returns: Locator for the input element

getAriaLabelLocator

Get the locator for the sr-label slot. Returns: Locator for the ARIA label element

getFocusLocator

Get the locator to use for focus operations. Returns: The input locator

getEnabledLocator

Get the locator to use for enabled/disabled checks. Returns: The input locator

getLabelLocator

Get the locator for the label slot. Returns: Locator for the label element

Usage Examples

Basic Selection

Validation

Placeholder

Prefix

Focus and Enabled State

ARIA Label

Tooltip