Skip to main content

Overview

MenuBarElement is a Playwright wrapper for the <vaadin-menu-bar> component. It provides utilities to access menu items and open submenus. Component tag: vaadin-menu-bar Implements:
  • HasThemeElement
  • HasStyleElement
  • HasAriaLabelElement

Constructors

Create a MenuBarElement from the page by locating the first <vaadin-menu-bar> element.
Page
required
The Playwright page instance
Create a MenuBarElement from an existing locator.
Locator
required
The Playwright locator for the menu bar element

Methods

getMenuItemElement(String name)

Get a menu item by its visible label.
String
required
The visible label text of the menu item
Returns: MenuItemElement - The menu item element with the specified label

openSubMenu(String name)

Click a menu item to open its submenu and return the submenu overlay.
String
required
The visible label text of the menu item that contains a submenu
Returns: MenuElement - The opened submenu overlay

Static Factory Methods

getByLabel(Page page, String label)

Get a menu bar by its accessible label (ARIA label).
Page
required
The Playwright page instance
String
required
The accessible label of the menu bar (uses ARIA role MENUBAR)
Returns: MenuBarElement - The menu bar with the specified label

Usage Example