Skip to main content

SplitLayoutElement

Playwright element wrapper for <vaadin-split-layout> providing helpers to read/change orientation, access primary/secondary content, and control splitter position.

Component Tag

vaadin-split-layout

Implements

  • HasStyleElement - CSS class and style management
  • HasThemeElement - Theme variant support

Constructor

locator
Locator
required
Playwright locator for the <vaadin-split-layout> element

Static Factory Methods

get

Get the first split layout on the page.
SplitLayoutElement.get(Page page)
page
Page
Playwright page

Content Locators

getPrimaryLocator

Locator for the primary content (slot="primary").
Locator getPrimaryLocator()

getSecondaryLocator

Locator for the secondary content (slot="secondary").
Locator getSecondaryLocator()

getHandleLocator

Locator for the splitter handle (shadow part="handle").
Locator getHandleLocator()

Methods

dragSplitterBy

Drag the splitter by a delta offset in pixels. Positive X moves right, positive Y moves down.
void dragSplitterBy(double deltaX, double deltaY)
deltaX
double
Horizontal offset in pixels (positive = right)
deltaY
double
Vertical offset in pixels (positive = down)

Assertion Methods

assertVertical

Assert that the layout orientation is vertical.
void assertVertical()

assertHorizontal

Assert that the layout orientation is horizontal.
void assertHorizontal()

Usage Examples

Access Primary and Secondary Content

SplitLayoutElement splitLayout = SplitLayoutElement.get(page);

Locator primary = splitLayout.getPrimaryLocator();
Locator secondary = splitLayout.getSecondaryLocator();

assertThat(primary).containsText("Left panel content");
assertThat(secondary).containsText("Right panel content");

Verify Orientation

SplitLayoutElement splitLayout = SplitLayoutElement.get(page);
splitLayout.assertHorizontal();

// After changing to vertical
splitLayout.assertVertical();

Drag the Splitter

SplitLayoutElement splitLayout = SplitLayoutElement.get(page);

// Drag splitter 100px to the right
splitLayout.dragSplitterBy(100, 0);

// For vertical layout, drag down
splitLayout.dragSplitterBy(0, 50);

Access Splitter Handle

SplitLayoutElement splitLayout = SplitLayoutElement.get(page);
Locator handle = splitLayout.getHandleLocator();

assertThat(handle).isVisible();
handle.hover(); // Show hover state

Work with Nested Components

SplitLayoutElement splitLayout = SplitLayoutElement.get(page);

// Find button in primary panel
ButtonElement button = ButtonElement.getByText(
    splitLayout.getPrimaryLocator(), 
    "Primary Action"
);
button.click();

// Access grid in secondary panel
GridElement grid = GridElement.get(splitLayout.getSecondaryLocator());
assertEquals(10, grid.getTotalRowCount());

Build docs developers (and LLMs) love