Skip to main content

DatePickerElement

Playwright element wrapper for <vaadin-date-picker>. Adds convenience methods for LocalDate values and lookup by label.

Component Tag

vaadin-date-picker

Implements

  • HasInputFieldElement
  • HasValidationPropertiesElement
  • HasClearButtonElement
  • HasPlaceholderElement
  • HasThemeElement
  • FocusableElement
  • HasAriaLabelElement
  • HasEnabledElement
  • HasTooltipElement
  • HasLabelElement
  • HasHelperElement

Factory Methods

getByLabel (Page)

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

getByLabel (Locator)

Get the DatePickerElement by its label within a given scope.
Locator
required
The locator to search within
String
required
The accessible label of the field
Returns: The matching DatePickerElement

Constructor

DatePickerElement

Create a new DatePickerElement.
Locator
required
The locator for the <vaadin-date-picker> element

Methods

setValue (LocalDate)

Set the value using a LocalDate formatted as ISO-8601.
LocalDate
required
The date to set

setValue (String)

Set the value of the input.
String
required
Value formatted as in the view (dd/mm/yyyy)

getValueAsLocalDate

Get the current value as a LocalDate. Returns: The parsed date or null when empty

assertValue (String)

Assert that the input value equals the provided string.
String
required
Expected value formatted as in the view (dd/mm/yyyy)

assertValue (LocalDate)

Assert that the value equals the provided date.
LocalDate
Expected LocalDate or null for empty

getAriaLabelLocator

Get the locator for ARIA label. Returns: The input locator

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

Usage Examples

Basic Date Selection

String Format

Min/Max Validation

Theme

Focus

ARIA Label

Enabled/Disabled

Tooltip