Class 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addSheet()
      Adds a new sheet.
      com.vaadin.testbench.TestBenchElement getAddressField()
      Gets the address field.
      SheetCellElement getCellAt​(int row, int column)
      Gets the cell element at the given coordinates for the currently active sheet.
      SheetCellElement getCellAt​(String cellAddress)
      Gets the cell element at the given cell address for the currently active sheet.
      org.openqa.selenium.WebElement getCellValueInput()  
      SheetHeaderElement getColumnHeader​(int columnIndex)
      Gets the column header element at the given index.
      SpreadsheetElement.ContextMenuElement getContextMenu()
      Fetches the context menu for the spreadsheet
      com.vaadin.testbench.TestBenchElement getFormulaField()
      Gets the formula field.
      com.vaadin.testbench.TestBenchElement getInfoLabel()
      Gets the info label.
      SheetHeaderElement getRowHeader​(int rowIndex)
      Gets the row header element at the given index.
      boolean isPopupButtonPopupVisible()
      Determine if the pop-up of PopupuButton is currently visible
      void scroll​(int scrollTop)  
      void scrollLeft​(int scrollLeft)  
      void scrollSheets​(int amount)
      Scrolls the sheet selector left or right by the given amount.
      void scrollSheetsToEnd()
      Scrolls the sheet selector to the end.
      void scrollSheetsToStart()
      Scrolls the sheet selector to the beginning.
      void selectSheet​(String sheetName)
      Selects the sheet with the given name.
      void selectSheetAt​(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
      • Methods inherited from interface com.vaadin.testbench.HasElementQuery

        $, $
      • Methods inherited from interface org.openqa.selenium.WebElement

        getAccessibleName, getAriaRole, getDomAttribute, getDomProperty
    • Constructor Detail

      • SpreadsheetElement

        public SpreadsheetElement()
    • 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-based
        column - 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:
        scroll in class com.vaadin.testbench.TestBenchElement
      • scrollLeft

        public void scrollLeft​(int scrollLeft)
        Overrides:
        scrollLeft in class com.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.
      • getCellValueInput

        public org.openqa.selenium.WebElement getCellValueInput()
      • isPopupButtonPopupVisible

        public boolean isPopupButtonPopupVisible()
        Determine if the pop-up of PopupuButton is currently visible