Overview
SideNavigationItemElement is a Playwright wrapper for <vaadin-side-nav-item>. It represents individual navigation items within a side navigation menu.
Component tag: vaadin-side-nav-item
Implements:
HasEnabledElementHasPrefixElementHasSuffixElementHasLabelElement
Constructors
SideNavigationItemElement(Locator locator)
Create aSideNavigationItemElement from an existing locator.
The Playwright locator for the side navigation item element
Methods
isExpanded()
Check if the item is expanded (showing child items). Returns:boolean - True if the item is expanded
assertExpanded()
Assert that the item is expanded. Verifies: The element has theexpanded attribute.
assertCollapsed()
Assert that the item is collapsed. Verifies: The element does not have theexpanded attribute.
assertEnabled()
Assert that the item is enabled. Verifies: The element does not have thedisabled attribute.
assertDisabled()
Assert that the item is disabled. Verifies: The element has thedisabled attribute.
assertCurrent()
Assert that the item is the current/active navigation item. Verifies: The element has thecurrent attribute.
assertNotCurrent()
Assert that the item is not the current navigation item. Verifies: The element does not have thecurrent attribute.
toggle()
Toggle the expansion state of the item. This clicks the toggle button inside the item. Note: Only works for items with children that have a toggle button.navigate()
Navigate by clicking the internal link of the navigation item. Uses: ARIA rolelink to find and click the navigation link.
getLabelLocator()
Get the locator for the item’s label. Returns:Locator - The item element itself (label is part of the component)
Usage Example
Notes
- Items with children can be expanded/collapsed using the
toggle()method - The
currentattribute indicates the active navigation item - Disabled items cannot be clicked but may still be visible
- The
navigate()method uses the internal link element with ARIA rolelink
Related Elements
- SideNavigationElement - Parent side navigation container