GridElement
Playwright element wrapper for<vaadin-grid> providing helpers for scrolling, querying visible rows, accessing cell content, and interacting with the grid’s header, body, and selection.
Component Tag
vaadin-grid
Implements
FocusableElement- Focus managementHasStyleElement- CSS class and style managementHasThemeElement- Theme variant supportHasEnabledElement- Enable/disable state
Constructor
Playwright locator for the
<vaadin-grid> elementStatic Factory Methods
get
Get the first grid on the page or within a parent locator.Playwright page
Parent locator to search within
getById
Get a grid by its id attribute.Playwright page
Element id
Row and Column Methods
getTotalRowCount
Get the total number of rows (data items) in the grid.getRenderedRowCount
Get the number of rows currently rendered in the DOM (may be less than total due to virtualization).getColumnCount
Get the number of visible (non-hidden) columns.isAllRowsVisible
Whether the grid has allRowsVisible enabled.Header Methods
findHeaderCell
Find a header cell by column index.0-based header row index (default 0)
0-based visible column index
findHeaderCellByText
Find a header cell by its text content.0-based header row index (default 0)
Header text to find
getHeaderCellContents
Get the text content of all visible header cells.Cell Access Methods
findCell
Find a body cell by row and column index, or by row index and column header text.0-based row index
0-based column index
Header text of the column
findRow
Find a row by its index (scrolls if necessary).0-based row index
RowElement wrapper providing cell access and selection methods.
findRowIndexesWithColumnText
Find row indexes where the cell in the given column has the given text.Column index to check
Text to match
Scroll Methods
scrollToRow
Scroll the grid so the given row index becomes visible.0-based row index
scrollToStart
Scroll to the very beginning of the grid.scrollToEnd
Scroll to the very end of the grid.Selection Methods
select
Select a row by index.Row index to select
deselect
Deselect a row by index.Row index to deselect
getSelectedItemCount
Get the number of currently selected items.checkSelectAll
Check the select-all checkbox.uncheckSelectAll
Uncheck the select-all checkbox.isSelectAllChecked
Check if the select-all checkbox is checked.isSelectAllIndeterminate
Check if the select-all checkbox is indeterminate.Utility Methods
waitForGridToStopLoading
Wait for the grid to finish loading after a scroll or other action.Inner Classes
CellElement
Represents a cell in the grid.Methods
Locator getTableCellLocator()- Get the table cell (td or th) locatorint getColumnIndex()- Get the 0-based column indexLocator getCellContentLocator()- Get the cell content locatorString getContentSlotName()- Get the slot name for cell contentvoid click()- Click the cell content
HeaderCellElement
ExtendsCellElement for header cells with sorting support.
Methods
boolean isSortable()- Whether the header supports sortingvoid clickSort()- Click to sort the columnboolean isSortAscending()- Whether sorted ascendingboolean isSortDescending()- Whether sorted descendingboolean isNotSorted()- Whether not sorted
RowElement
Represents a row in the grid.Methods
Locator getRowLocator()- Get the row (tr) locatorint getRowIndex()- Get the 0-based row indexCellElement getCell(int columnIndex)- Get cell by column indexCellElement getCell(String columnHeaderText)- Get cell by header textCellElement getDetailsCell()- Get the details cellboolean isSelected()- Whether the row is selectedvoid select()- Select the rowvoid deselect()- Deselect the rowvoid openDetails()- Open row detailsvoid closeDetails()- Close row detailsboolean isDetailsOpen()- Whether details are open