Overview
MenuItemElement is a Playwright wrapper for individual menu items <vaadin-menu-bar-button>. It represents clickable menu items within menu bars and submenu overlays.
Component tag: vaadin-menu-bar-button
Implements:
HasThemeElementHasStyleElementHasAriaLabelElement
Constructors
MenuItemElement(Locator locator)
Create aMenuItemElement from an existing locator.
Locator
required
The Playwright locator for the menu item element
Methods
assertExpanded()
Assert that the menu item is expanded (shows submenu). Verifies: The element has theexpanded attribute.
assertCollapsed()
Assert that the menu item is collapsed (submenu is not visible). Verifies: The element does not have theexpanded attribute.
Static Factory Methods
getByLabel(Locator locator, String label)
Get a menu item by its accessible label within a scope.Locator
required
The parent locator (menu bar or menu overlay) to search within
String
required
The accessible label of the menu item (uses ARIA role MENUITEM)
MenuItemElement - The menu item with the specified label
Usage Example
Related Elements
- MenuBarElement - Top-level menu bar
- MenuElement - Submenu overlay list