Skip to main content

Overview

The CheckboxElement class is a Playwright wrapper for the <vaadin-checkbox> component. It provides methods to interact with checkboxes, including checking/unchecking and managing indeterminate state.

Component Tag

<vaadin-checkbox>

Extends

  • VaadinElement

Implements

  • FocusableElement - Focus and blur operations
  • HasAriaLabelElement - ARIA label support
  • HasEnabledElement - Enabled/disabled state
  • HasHelperElement - Helper text
  • HasValueElement - Value handling
  • HasStyleElement - CSS styling
  • HasLabelElement - Label text
  • HasValidationPropertiesElement - Validation state and error messages

Constructor

Locator
required
The Playwright locator for the <vaadin-checkbox> element

Factory Methods

getByLabel

Get a checkbox by its accessible label. Uses ARIA role checkbox.
Page
required
The Playwright page
String
required
The accessible label of the checkbox

Example

Methods

isChecked

Check if the checkbox is currently checked.
Returns: true if checked, false otherwise

assertChecked

Assert that the checkbox is checked.

assertNotChecked

Assert that the checkbox is not checked.

Example

check

Check the checkbox.

uncheck

Uncheck the checkbox.

Example

isIndeterminate

Check if the checkbox is in indeterminate state.
Returns: true when indeterminate, false otherwise

assertIndeterminate

Assert that the checkbox is indeterminate.

assertNotIndeterminate

Assert that the checkbox is not indeterminate.

setIndeterminate

Set the indeterminate state.
boolean
required
true to set indeterminate, false to clear

Example

getEnabledLocator

Get the locator for enabled/disabled state. Returns the input locator.

getAriaLabelLocator

Get the locator for ARIA label operations. Returns the input locator.

getFocusLocator

Get the locator for focus operations. Returns the input locator.

Inherited Methods

From HasValueElement:
  • getValue() - Get current value
  • setValue(String value) - Set field value
  • clear() - Clear the value
  • assertValue(String value) - Assert value matches
  • getInputLocator() - Get input element locator
From HasValidationPropertiesElement:
  • assertValid() - Assert checkbox is valid
  • assertInvalid() - Assert checkbox is invalid
  • assertErrorMessage(String message) - Assert error message text
  • getErrorMessageLocator() - Get error message locator
From HasLabelElement:
  • getLabel() - Get label text
  • assertLabel(String label) - Assert label text
  • getLabelLocator() - Get label locator
From HasHelperElement:
  • getHelperText() - Get helper text
  • assertHelperHasText(String text) - Assert helper text
  • getHelperLocator() - Get helper locator
From FocusableElement:
  • focus() - Focus the checkbox
  • blur() - Blur the checkbox
  • getTabIndex() - Get tab index
  • assertIsFocused() - Assert checkbox has focus
  • assertIsNotFocused() - Assert checkbox does not have focus
From HasEnabledElement:
  • assertEnabled() - Assert checkbox is enabled
  • assertDisabled() - Assert checkbox is disabled
From HasAriaLabelElement:
  • assertAriaLabel(String label) - Assert ARIA label

Complete Example