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
    Modifier and Type
    Class
    Description
    static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a new sheet.
    com.vaadin.testbench.TestBenchElement
    Gets the address field.
    getCellAt(int row, int column)
    Gets the cell element at the given coordinates for the currently active sheet.
    getCellAt(String cellAddress)
    Gets the cell element at the given cell address for the currently active sheet.
    org.openqa.selenium.WebElement
     
    getColumnHeader(int columnIndex)
    Gets the column header element at the given index.
    Fetches the context menu for the spreadsheet
    com.vaadin.testbench.TestBenchElement
    Gets the formula field.
    com.vaadin.testbench.TestBenchElement
    Gets the info label.
    getRowHeader(int rowIndex)
    Gets the row header element at the given index.
    boolean
    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
    Scrolls the sheet selector to the end.
    void
    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, 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, wrapElements

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods 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

      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.
    • 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