Overview
TheCheckboxElement 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 operationsHasAriaLabelElement- ARIA label supportHasEnabledElement- Enabled/disabled stateHasHelperElement- Helper textHasValueElement- Value handlingHasStyleElement- CSS stylingHasLabelElement- Label textHasValidationPropertiesElement- Validation state and error messages
Constructor
The Playwright locator for the
<vaadin-checkbox> elementFactory Methods
getByLabel
Get a checkbox by its accessible label. Uses ARIA rolecheckbox.
The Playwright page
The accessible label of the checkbox
Example
Methods
isChecked
Check if the checkbox is currently checked.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.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.true to set indeterminate, false to clearExample
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
FromHasValueElement:
getValue()- Get current valuesetValue(String value)- Set field valueclear()- Clear the valueassertValue(String value)- Assert value matchesgetInputLocator()- Get input element locator
HasValidationPropertiesElement:
assertValid()- Assert checkbox is validassertInvalid()- Assert checkbox is invalidassertErrorMessage(String message)- Assert error message textgetErrorMessageLocator()- Get error message locator
HasLabelElement:
getLabel()- Get label textassertLabel(String label)- Assert label textgetLabelLocator()- Get label locator
HasHelperElement:
getHelperText()- Get helper textassertHelperHasText(String text)- Assert helper textgetHelperLocator()- Get helper locator
FocusableElement:
focus()- Focus the checkboxblur()- Blur the checkboxgetTabIndex()- Get tab indexassertIsFocused()- Assert checkbox has focusassertIsNotFocused()- Assert checkbox does not have focus
HasEnabledElement:
assertEnabled()- Assert checkbox is enabledassertDisabled()- Assert checkbox is disabled
HasAriaLabelElement:
assertAriaLabel(String label)- Assert ARIA label