Skip to main content

Overview

SideNavigationElement is a Playwright wrapper for the <vaadin-side-nav> component. It provides utilities to manage collapsible navigation menus and access navigation items. Component tag: vaadin-side-nav Implements:
  • HasLabelElement

Constructors

SideNavigationElement(Locator locator)

Create a SideNavigationElement from an existing locator.
Locator
required
The Playwright locator for the side navigation element

Methods

isCollapsed()

Check if the side nav is collapsed. Returns: boolean - True if the side navigation is collapsed

assertCollapsed()

Assert that the side nav is collapsed. Verifies: The element has the collapsed attribute.

assertExpanded()

Assert that the side nav is expanded. Verifies: The element does not have the collapsed attribute.

assertCollapsible()

Assert that the side nav is collapsible. Verifies: The element has the collapsible attribute.

assertNotCollapsible()

Assert that the side nav is not collapsible. Verifies: The element does not have the collapsible attribute.

getItem(String label)

Get a SideNavigationItemElement by its label text. This searches for a direct or nested vaadin-side-nav-item with the given text.
String
required
The label text of the navigation item
Returns: SideNavigationItemElement - The navigation item with the specified label Note: The navigation item must be visible. You may need to expand parent items first.

clickItem(String label)

Click a navigation item by its label.
String
required
The label text of the navigation item to click

toggle()

Toggle the expansion state of the side navigation. Clicks the label slot to collapse/expand.

getLabelLocator()

Get the locator for the side navigation label slot. Returns: Locator - Locator for the [slot='label'] element

Static Factory Methods

getByLabel(Page page, String label)

Get the SideNavigationElement by its accessible label.
Page
required
The Playwright page instance
String
required
The accessible label of the side navigation (uses ARIA role NAVIGATION)
Returns: SideNavigationElement - The side navigation with the specified label

Usage Example