Class SpreadsheetElement
java.lang.Object
com.vaadin.testbench.TestBenchElement
com.vaadin.flow.component.spreadsheet.testbench.SpreadsheetElement
- All Implemented Interfaces:
com.vaadin.testbench.commands.CanCompareScreenshots,com.vaadin.testbench.HasCallFunction,com.vaadin.testbench.HasDriver,com.vaadin.testbench.HasElementQuery,com.vaadin.testbench.HasPropertySettersGetters,com.vaadin.testbench.HasSearchContext,com.vaadin.testbench.HasTestBenchCommandExecutor,org.openqa.selenium.SearchContext,org.openqa.selenium.TakesScreenshot,org.openqa.selenium.WebElement,org.openqa.selenium.WrapsElement
public class SpreadsheetElement
extends com.vaadin.testbench.TestBenchElement
This is the base element class for accessing a Vaadin Spreadsheet component
for TestBench testing.
- Author:
- Vaadin Ltd.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSheet()Adds a new sheet.com.vaadin.testbench.TestBenchElementGets the address field.getCellAt(int row, int column) Gets the cell element at the given coordinates for the currently active sheet.Gets the cell element at the given cell address for the currently active sheet.org.openqa.selenium.WebElementgetColumnHeader(int columnIndex) Gets the column header element at the given index.Fetches the context menu for the spreadsheetcom.vaadin.testbench.TestBenchElementGets the formula field.com.vaadin.testbench.TestBenchElementGets the info label.getRowHeader(int rowIndex) Gets the row header element at the given index.booleanDetermine if the pop-up of PopupuButton is currently visiblevoidscroll(int scrollTop) voidscrollLeft(int scrollLeft) voidscrollSheets(int amount) Scrolls the sheet selector left or right by the given amount.voidScrolls the sheet selector to the end.voidScrolls the sheet selector to the beginning.voidselectSheet(String sheetName) Selects the sheet with the given name.voidselectSheetAt(int sheetIndex) Selects the sheet at the given index.Methods inherited from class com.vaadin.testbench.TestBenchElement
callFunction, clear, click, click, compareScreen, compareScreen, compareScreen, contextClick, dispatchEvent, dispatchEvent, doubleClick, equals, executeScript, findElement, findElements, focus, getAttribute, getCapabilities, getChildren, getClassNames, getCommandExecutor, getContext, getCssValue, getDomAttribute, getDomProperty, getDriver, getId, getLocation, getParent, getProperty, getPropertyBoolean, getPropertyDouble, getPropertyElement, getPropertyElements, getPropertyInteger, getPropertyString, getRect, getScreenshotAs, getShadowRoot, getSize, getTagName, getText, getWrappedElement, hasAttribute, hasClassName, hashCode, hover, init, init, isChrome, isDisplayed, isEnabled, isFirefox, isFocused, isReadOnly, isSelected, scrollIntoView, sendKeys, setProperty, setProperty, setProperty, setProperty, submit, waitForVaadin, waitUntil, waitUntil, wrap, wrapElement, wrapElementsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.testbench.HasElementQuery
$, $Methods inherited from interface org.openqa.selenium.WebElement
getAccessibleName, getAriaRole
-
Constructor Details
-
SpreadsheetElement
public SpreadsheetElement()
-
-
Method Details
-
getCellAt
Gets the cell element at the given coordinates for the currently active sheet. Throws NoSuchElementException if the cell is outside the visible area.- Parameters:
row- Row index, 1-basedcolumn- Column index, 1-based- Returns:
- Cell element at the given index.
- Throws:
org.openqa.selenium.NoSuchElementException- if the cell at (row, column) is not found.
-
getCellAt
Gets the cell element at the given cell address for the currently active sheet. Throws NoSuchElementException if the cell is outside the visible area.- Parameters:
cellAddress- Target address, e.g. A3- Returns:
- Cell element at the given index.
- Throws:
org.openqa.selenium.NoSuchElementException- if the cell at (cellAddress) is not found.
-
getRowHeader
Gets the row header element at the given index.- Parameters:
rowIndex- Index of target row, 1-based- Returns:
- Header of the row at the given index
-
getColumnHeader
Gets the column header element at the given index.- Parameters:
columnIndex- Index of target column, 1-based- Returns:
- Header of the column at the given index
-
getAddressField
public com.vaadin.testbench.TestBenchElement getAddressField()Gets the address field. The address field contains the address of the cell that was last clicked, or A1 if no clicks have yet been made.- Returns:
- Address field element
-
getFormulaField
public com.vaadin.testbench.TestBenchElement getFormulaField()Gets the formula field. This field is where the user can input data for the cell whose address the address field currently contains.- Returns:
- Formula field element
-
getInfoLabel
public com.vaadin.testbench.TestBenchElement getInfoLabel()Gets the info label. Info label is the small text at the bottom right corner of the Spreadsheet.- Returns:
- Info label element
-
scroll
public void scroll(int scrollTop) - Overrides:
scrollin classcom.vaadin.testbench.TestBenchElement
-
scrollLeft
public void scrollLeft(int scrollLeft) - Overrides:
scrollLeftin classcom.vaadin.testbench.TestBenchElement
-
scrollSheetsToStart
public void scrollSheetsToStart()Scrolls the sheet selector to the beginning. Has no effect if there are not enough sheets to require scrolling. -
scrollSheetsToEnd
public void scrollSheetsToEnd()Scrolls the sheet selector to the end. Has no effect if there are not enough sheets to require scrolling. -
scrollSheets
public void scrollSheets(int amount) Scrolls the sheet selector left or right by the given amount. Has no effect if there are not enough sheets to require scrolling.- Parameters:
amount- Amount to scroll. Positive numbers scroll to the right and negative numbers scroll to the left.
-
selectSheetAt
public void selectSheetAt(int sheetIndex) Selects the sheet at the given index. Indexes are counted only for visible sheets.- Parameters:
sheetIndex- Index of sheet to select, 0-based
-
selectSheet
Selects the sheet with the given name. Only visible sheets can be selected.- Parameters:
sheetName- Name of sheet to select
-
addSheet
public void addSheet()Adds a new sheet. -
getContextMenu
Fetches the context menu for the spreadsheet- Returns:
SpreadsheetElement.ContextMenuElement- Throws:
NoSuchElementException- if the menu isn't open
-
getCellValueInput
public org.openqa.selenium.WebElement getCellValueInput() -
isPopupButtonPopupVisible
public boolean isPopupButtonPopupVisible()Determine if the pop-up of PopupuButton is currently visible
-