Overview
DialogElement is a Playwright wrapper for <vaadin-dialog>. It provides access to header, content, and footer slots, as well as modal flags and open state management.
Component tag: vaadin-dialog
Implements:
HasThemeElementHasStyleElement
Constructors
DialogElement(Page page)
Create aDialogElement by resolving the dialog with ARIA role dialog.
The Playwright page instance
DialogElement(Locator locator)
Create aDialogElement from an existing locator.
The Playwright locator for the dialog element
Methods
closeWithEscape()
Close the dialog using the Escape key.isOpen()
Check whether the dialog is open (visible). Returns:boolean - True if the dialog is visible
assertOpen()
Assert that the dialog is open. Verifies: The element has theopened attribute.
assertClosed()
Assert that the dialog is closed (hidden). Verifies: The element is hidden in the DOM.isModal()
Check whether the dialog is modal (i.e., not modeless). Returns:boolean - True if the dialog is modal
assertModal()
Assert that the dialog is modal. Verifies: The element does not have themodeless attribute.
assertModeless()
Assert that the dialog is modeless. Verifies: The element has themodeless attribute.
getHeaderText()
Get the header text from the title slot. Returns:String - The text content of the header
assertHeaderText(String headerText)
Assert that the header text matches the expected value.The expected header text
getHeaderLocator()
Get the locator for the header content slot. Returns:Locator - Locator for [slot='header-content']
getContentLocator()
Get the locator for the dialog content (first non-slotted child). Returns:Locator - Locator for the main content area
getFooterLocator()
Get the locator for the footer slot. Returns:Locator - Locator for [slot='footer']
Static Factory Methods
getByHeaderText(Page page, String summary)
Get a dialog by its header text (accessible name).The Playwright page instance
The header text that serves as the dialog’s accessible name
DialogElement - The dialog with the specified header text
Usage Example
Notes
- Modal dialogs block interaction with the rest of the page
- Modeless dialogs allow interaction with other page elements
- The dialog uses ARIA role
dialogfor accessibility - Header text serves as the accessible name of the dialog