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.TestBenchElementThis is the base element class for accessing a Vaadin Spreadsheet component for TestBench testing.- Author:
- Vaadin Ltd.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpreadsheetElement.ContextMenuElement
-
Constructor Summary
Constructors Constructor Description SpreadsheetElement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSheet()Adds a new sheet.com.vaadin.testbench.TestBenchElementgetAddressField()Gets the address field.SheetCellElementgetCellAt(int row, int column)Gets the cell element at the given coordinates for the currently active sheet.SheetCellElementgetCellAt(String cellAddress)Gets the cell element at the given cell address for the currently active sheet.org.openqa.selenium.WebElementgetCellValueInput()SheetHeaderElementgetColumnHeader(int columnIndex)Gets the column header element at the given index.SpreadsheetElement.ContextMenuElementgetContextMenu()Fetches the context menu for the spreadsheetcom.vaadin.testbench.TestBenchElementgetFormulaField()Gets the formula field.com.vaadin.testbench.TestBenchElementgetInfoLabel()Gets the info label.SheetHeaderElementgetRowHeader(int rowIndex)Gets the row header element at the given index.booleanisPopupButtonPopupVisible()Determine 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.voidscrollSheetsToEnd()Scrolls the sheet selector to the end.voidscrollSheetsToStart()Scrolls 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, 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, wrapElements
-
-
-
-
Method Detail
-
getCellAt
public SheetCellElement getCellAt(int row, int column)
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
public SheetCellElement getCellAt(String cellAddress)
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
public SheetHeaderElement getRowHeader(int rowIndex)
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
public SheetHeaderElement getColumnHeader(int columnIndex)
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
public void selectSheet(String sheetName)
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
public SpreadsheetElement.ContextMenuElement 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
-
-