TabSheetElement
Playwright element wrapper for <vaadin-tabsheet> providing helpers to access/select tabs and view current content panel.
Component Tag
vaadin-tabsheet
Constructor
Playwright locator for the <vaadin-tabsheet> element
Static Factory Methods
get
Get the first tabsheet instance on the page.
TabSheetElement.get(Page page)
Methods
getTab
Get a tab by its label text.
TabElement getTab(String label)
Returns a TabElement for the matching tab.
getSelectedTab
Get the currently selected tab.
TabElement getSelectedTab()
Returns the TabElement that is currently selected.
selectTab
Select a tab by label text.
void selectTab(String label)
getContentLocator
Locator for the currently visible content panel.
Locator getContentLocator()
Returns a locator for the tab panel that is currently visible (not hidden).
Assertion Methods
assertTabsCount
Assert the number of tabs.
void assertTabsCount(int count)
Usage Examples
Basic Tab Operations
TabSheetElement tabSheet = TabSheetElement.get(page);
tabSheet.assertTabsCount(3);
// Select a tab
tabSheet.selectTab("Details");
// Check selected tab
TabElement selectedTab = tabSheet.getSelectedTab();
assertEquals("Details", selectedTab.getLabel());
Access Tab Content
TabSheetElement tabSheet = TabSheetElement.get(page);
tabSheet.selectTab("Settings");
// Get visible content
Locator content = tabSheet.getContentLocator();
assertThat(content).containsText("Settings panel content");
Work with Individual Tabs
TabSheetElement tabSheet = TabSheetElement.get(page);
TabElement tab = tabSheet.getTab("Details");
tab.assertNotSelected();
tab.select();
tab.assertSelected();
Verify Tab Selection
TabSheetElement tabSheet = TabSheetElement.get(page);
// Initially first tab selected
TabElement firstTab = tabSheet.getTab("Overview");
firstTab.assertSelected();
// Switch to second tab
tabSheet.selectTab("Details");
firstTab.assertNotSelected();
tabSheet.getTab("Details").assertSelected();