Skip to main content

Overview

HasValueElement is a mixin interface for Vaadin components that expose a textual value through an input slot. This interface provides methods to get, set, clear, and assert input values.

Methods

getInputLocator

Returns the locator for the native input element inside the component. Returns: Locator for the element with slot="input" attribute

getValue

Gets the current string value of the input field. Returns: The current value as a string

setValue

Sets the field value by filling the input and dispatching a change event.
String
The value to set in the input field

clear

Clears the input value by setting it to an empty string.

assertValue

Asserts that the input value matches the expected string using Playwright assertions.
String
The expected value to assert against

Implementation Details

This interface extends HasLocatorElement and provides default implementations for all methods. The value operations work on the input slot element, which is located using *[slot="input"]. The setValue() method not only fills the input but also dispatches a change event to ensure that client-side listeners are triggered.

Implementing Classes

This interface is implemented through HasInputFieldElement, which is used by:
  • TextFieldElement (and its subclasses like EmailFieldElement, PasswordFieldElement, etc.)
  • AbstractNumberFieldElement (and its subclasses like IntegerFieldElement, NumberFieldElement)
  • BigDecimalFieldElement
  • ComboBoxElement
  • MultiSelectComboBoxElement
  • SelectElement
  • DatePickerElement
  • DateTimePickerElement
  • TimePickerElement

Usage Example

See Also