com.vaadin.flow.component.grid.testbench.

Class GridElement

    • Constructor Detail

      • GridElement

        public GridElement()
    • Method Detail

      • scrollToRow

        public void scrollToRow(int row)

        Scrolls to the row with the given index.

        Parameters:

        row - the row to scroll to

      • getPageSize

        public int getPageSize()

        Gets the page size used when fetching data.

        Returns:

        the page size

      • getFirstVisibleRowIndex

        public int getFirstVisibleRowIndex()

        Gets the index of the first row which is at least partially visible.

        Returns:

        the index of the first visible row

      • getRowCount

        public int getRowCount()

        Gets the total number of rows.

        Returns:

        the number of rows

      • getCell

        public GridTHTDElement getCell(int rowIndex,
                                       int colIndex)

        Gets the grid cell for the given row and column index.

        For the column index, only visible columns are taken into account.

        Automatically scrolls the given row into view

        Parameters:

        rowIndex - the row index

        colIndex - the column index

        Returns:

        the grid cell for the given coordinates

      • getCell

        public GridTHTDElement getCell(int rowIndex,
                                       GridColumnElement column)

        Gets the grid cell for the given row and column.

        Automatically scrolls the given row into view

        Parameters:

        rowIndex - the row index

        column - the column element for the column

        Returns:

        the grid cell for the given coordinates

      • getCell

        public GridTHTDElement getCell(String contents)
                                throws org.openqa.selenium.NoSuchElementException

        Finds the first cell inside the rendered range with a text content matching the given string.

        Parameters:

        contents - the string to look for

        Returns:

        a grid cell containing the given string

        Throws:

        org.openqa.selenium.NoSuchElementException - if no cell with the given string was found

      • getRow

        public GridTRElement getRow(int rowIndex)

        Gets the tr element for the given row index.

        Parameters:

        rowIndex - the row index

        Returns:

        the tr element for the row

      • getAllColumns

        public List<GridColumnElement> getAllColumns()

        Gets all columns defined for the grid, including any selection checkbox column.

        Returns:

        a list of grid column elements which can be used to refer to the given column

      • generatedColumnIdsIfNeeded

        protected void generatedColumnIdsIfNeeded()
      • getVisibleColumns

        public List<GridColumnElement> getVisibleColumns()

        Gets the currently visible columns in the grid, including any selection checkbox column.

        Returns:

        a list of grid column elements which can be used to refer to the given column

      • getColumn

        public GridColumnElement getColumn(String headerText)
                                    throws org.openqa.selenium.NoSuchElementException

        Gets the column with the given header text.

        If multiple columns are found with the same header text, returns the first column.

        Parameters:

        headerText - the text in the header

        Returns:

        the grid column element for the given column

        Throws:

        org.openqa.selenium.NoSuchElementException - if no column was found

      • getHeaderCell

        public GridTHTDElement getHeaderCell(int columnIndex)

        Gets the header cell for the given visible column index.

        Parameters:

        columnIndex - the index of the column

        Returns:

        a cell element for the header cell

      • getFooterCell

        public TestBenchElement getFooterCell(int columnIndex)

        Gets the footer cell for the given visible column index.

        Parameters:

        columnIndex - the index of the column

        Returns:

        a cell element for the footer cell

      • select

        public void select(int rowIndex)

        Selects the row with the given index.

        Parameters:

        rowIndex - the row to select

      • deselect

        public void deselect(int rowIndex)

        Deselects the row with the given index.

        Parameters:

        rowIndex - the row to deselect