Skip to main content

ButtonElement

Playwright element wrapper for <vaadin-button> providing lookup helpers and interaction methods.

Component Tag

vaadin-button

Implements

  • FocusableElement - Focus management
  • HasAriaLabelElement - ARIA label support
  • HasEnabledElement - Enable/disable state
  • HasPrefixElement - Prefix slot content
  • HasStyleElement - CSS class and style management
  • HasSuffixElement - Suffix slot content
  • HasThemeElement - Theme variant support
  • HasTooltipElement - Tooltip text

Constructor

Locator
required
Playwright locator for the <vaadin-button> element

Static Factory Methods

getByText

Get a button by its accessible name or visible text.
Page
Playwright page
Locator
Scope to search within
String
Button’s accessible name or text content
GetByRoleOptions
Options for getByRole (ARIA BUTTON role)

getByLabel

Alias for getByText(Page, String).

Methods

All methods from implemented mixin interfaces are available. See:
  • click() - Click the button
  • focus() - Focus the button
  • assertEnabled() - Assert button is enabled
  • assertDisabled() - Assert button is disabled
  • assertAriaLabel(String) - Assert ARIA label
  • getPrefixLocator() - Get prefix slot locator
  • getSuffixLocator() - Get suffix slot locator
  • assertTheme(String) - Assert theme variant
  • assertTooltipHasText(String) - Assert tooltip text

Usage Examples

Basic Button Interaction

Check Theme and Style

Working with Disabled State

Prefix and Suffix Content

Focus Management

Scoped Lookup