Package com.vaadin.testbench.elements
Class GridElement
- java.lang.Object
-
- com.vaadin.testbench.AbstractHasTestBenchCommandExecutor
-
- com.vaadin.testbench.TestBenchElement
-
- com.vaadin.testbench.elementsbase.AbstractElement
-
- com.vaadin.testbench.elements.AbstractComponentElement
-
- com.vaadin.testbench.elements.GridElement
-
- All Implemented Interfaces:
com.vaadin.testbench.commands.CanCompareScreenshots,com.vaadin.testbench.commands.CanWaitForVaadin,com.vaadin.testbench.commands.TestBenchElementCommands,com.vaadin.testbench.HasDriver,com.vaadin.testbench.HasSearchContext,com.vaadin.testbench.HasTestBenchCommandExecutor,org.openqa.selenium.SearchContext,org.openqa.selenium.TakesScreenshot,org.openqa.selenium.WebElement,org.openqa.selenium.WrapsElement
- Direct Known Subclasses:
TreeGridElement
public class GridElement extends AbstractComponentElement
TestBench Element API for Grid.- Author:
- Vaadin Ltd
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGridElement.GridCellElementstatic classGridElement.GridEditorElementstatic classGridElement.GridRowElement-
Nested classes/interfaces inherited from class com.vaadin.testbench.elements.AbstractComponentElement
AbstractComponentElement.ReadOnlyException
-
-
Constructor Summary
Constructors Constructor Description GridElement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.vaadin.testbench.TestBenchElementgetBody()Get the body element.GridElement.GridCellElementgetCell(int rowIndex, int colIndex)Gets cell element with given row and column index.com.vaadin.testbench.TestBenchElementgetDetails(int rowIndex)Gets the element that contains the details of a row.GridElement.GridEditorElementgetEditor()com.vaadin.testbench.TestBenchElementgetFooter()Get the footer element.GridElement.GridCellElementgetFooterCell(int rowIndex, int colIndex)Gets footer cell element with given row and column index.List<GridElement.GridCellElement>getFooterCells(int rowIndex)Gets list of header cell elements on given row.intgetFooterCount()Get footer row count.com.vaadin.testbench.TestBenchElementgetFooterRow(int rowIndex)Get a footer row by index.com.vaadin.testbench.TestBenchElementgetHeader()Get the header element.GridElement.GridCellElementgetHeaderCell(int rowIndex, int colIndex)Gets header cell element with given row and column index.GridElement.GridCellElementgetHeaderCellByCaption(int rowIndex, String caption)Gets the header cell element with the given caption in the given header row.GridElement.GridCellElementgetHeaderCellByCaption(String caption)Finds the header cell element with the given caption.List<GridElement.GridCellElement>getHeaderCells(int rowIndex)Gets list of header cell elements on given row.intgetHeaderCount()Get header row count.com.vaadin.testbench.TestBenchElementgetHeaderRow(int rowIndex)Get a header row by index.com.vaadin.testbench.TestBenchElementgetHorizontalScroller()Get the horizontal scroll element.GridElement.GridRowElementgetRow(int index)Gets row element with given row index.longgetRowCount()Gets the total number of data rows in the grid.Iterable<GridElement.GridRowElement>getRows()Gets all the data rows in the grid.com.vaadin.testbench.TestBenchElementgetTableWrapper()Get the element wrapping the table element.com.vaadin.testbench.TestBenchElementgetVerticalScroller()Get the vertical scroll element.voidscrollToRow(int index)Scrolls Grid element so that wanted row is displayed.voidtoggleColumnHidden(String toggleCaption)Toggles the column visibility.-
Methods inherited from class com.vaadin.testbench.elements.AbstractComponentElement
getCaption, getHTML, getStyleAttribute, isReadOnly
-
Methods inherited from class com.vaadin.testbench.TestBenchElement
clear, click, click, clickHiddenElement, compareScreen, compareScreen, compareScreen, contextClick, doubleClick, equals, findElement, findElements, focus, getAccessibleName, getAriaRole, getAttribute, getCapabilities, getClassNames, getCommandExecutor, getContext, getCssValue, getDomAttribute, getDriver, getId, getLocation, getRect, getScreenshotAs, getShadowRoot, getSize, getTagName, getText, getWrappedElement, hasAttribute, hasClassName, hashCode, init, init, isChrome, isDisplayed, isEnabled, isFirefox, isFocused, isSelected, scroll, scrollIntoView, scrollLeft, sendKeys, showTooltip, submit, waitForVaadin, waitUntil, waitUntil, wrap, wrapElement, wrapElements
-
Methods inherited from class com.vaadin.testbench.AbstractHasTestBenchCommandExecutor
$, $$, isElementPresent, isElementPresent
-
-
-
-
Method Detail
-
scrollToRow
public void scrollToRow(int index)
Scrolls Grid element so that wanted row is displayed.- Parameters:
index- Target row
-
getCell
public GridElement.GridCellElement getCell(int rowIndex, int colIndex)
Gets cell element with given row and column index.- Parameters:
rowIndex- Row indexcolIndex- Column index- Returns:
- Cell element with given indices.
-
getRow
public GridElement.GridRowElement getRow(int index)
Gets row element with given row index.- Parameters:
index- Row index- Returns:
- Row element with given index.
-
getHeaderCell
public GridElement.GridCellElement getHeaderCell(int rowIndex, int colIndex)
Gets header cell element with given row and column index.- Parameters:
rowIndex- Row indexcolIndex- Column index- Returns:
- Header cell element with given indices.
-
getHeaderCellByCaption
public GridElement.GridCellElement getHeaderCellByCaption(String caption)
Finds the header cell element with the given caption. If there are multiple headers with the same name, the first one is returned.- Parameters:
caption- The header caption- Returns:
- The first header cell element with a given caption.
- Throws:
org.openqa.selenium.NoSuchElementException- if there is no header row or no header cell with the given text.
-
getHeaderCellByCaption
public GridElement.GridCellElement getHeaderCellByCaption(int rowIndex, String caption)
Gets the header cell element with the given caption in the given header row. If there are multiple headers with the same name, the first one is returned.- Parameters:
rowIndex- The index of the header rowcaption- The header caption- Returns:
- The first header cell element with a given caption.
- Throws:
org.openqa.selenium.NoSuchElementException- if there is no header row or no header cell with the given text.
-
getFooterCell
public GridElement.GridCellElement getFooterCell(int rowIndex, int colIndex)
Gets footer cell element with given row and column index.- Parameters:
rowIndex- Row indexcolIndex- Column index- Returns:
- Footer cell element with given indices.
-
getHeaderCells
public List<GridElement.GridCellElement> getHeaderCells(int rowIndex)
Gets list of header cell elements on given row.- Parameters:
rowIndex- Row index- Returns:
- Header cell elements on given row.
-
getFooterCells
public List<GridElement.GridCellElement> getFooterCells(int rowIndex)
Gets list of header cell elements on given row.- Parameters:
rowIndex- Row index- Returns:
- Header cell elements on given row.
-
getHeaderCount
public int getHeaderCount()
Get header row count.- Returns:
- Header row count
-
getFooterCount
public int getFooterCount()
Get footer row count.- Returns:
- Footer row count
-
getHeaderRow
public com.vaadin.testbench.TestBenchElement getHeaderRow(int rowIndex)
Get a header row by index.- Parameters:
rowIndex- Row index- Returns:
- The th element of the row
-
getFooterRow
public com.vaadin.testbench.TestBenchElement getFooterRow(int rowIndex)
Get a footer row by index.- Parameters:
rowIndex- Row index- Returns:
- The tr element of the row
-
getVerticalScroller
public com.vaadin.testbench.TestBenchElement getVerticalScroller()
Get the vertical scroll element.- Returns:
- The element representing the vertical scrollbar
-
getHorizontalScroller
public com.vaadin.testbench.TestBenchElement getHorizontalScroller()
Get the horizontal scroll element.- Returns:
- The element representing the horizontal scrollbar
-
getHeader
public com.vaadin.testbench.TestBenchElement getHeader()
Get the header element.- Returns:
- The thead element
-
getBody
public com.vaadin.testbench.TestBenchElement getBody()
Get the body element.- Returns:
- the tbody element
-
getFooter
public com.vaadin.testbench.TestBenchElement getFooter()
Get the footer element.- Returns:
- the tfoot element
-
getTableWrapper
public com.vaadin.testbench.TestBenchElement getTableWrapper()
Get the element wrapping the table element.- Returns:
- The element that wraps the table element
-
getEditor
public GridElement.GridEditorElement getEditor()
-
getDetails
public com.vaadin.testbench.TestBenchElement getDetails(int rowIndex) throws org.openqa.selenium.NoSuchElementExceptionGets the element that contains the details of a row.- Parameters:
rowIndex- the index of the row for the details- Returns:
- the element that contains the details of a row.
nullif no widget is defined for the details row - Throws:
org.openqa.selenium.NoSuchElementException- if the given details row is currently not open- Since:
- 8.0
-
toggleColumnHidden
public void toggleColumnHidden(String toggleCaption)
Toggles the column visibility. Column is identified by its hiding toggle caption.- Parameters:
toggleCaption-- Since:
- 8.0.6
-
getRowCount
public long getRowCount()
Gets the total number of data rows in the grid.- Returns:
- the number of data rows in the grid,
-
getRows
public Iterable<GridElement.GridRowElement> getRows()
Gets all the data rows in the grid.Returns an iterable which will lazily scroll rows into views and lazy load data as needed.
- Returns:
- an iterable of all the data rows in the grid.
-
-