Class TableElement

java.lang.Object
com.vaadin.testbench.TestBenchElement
com.vaadin.flow.component.html.testbench.TableElement
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 TableElement extends com.vaadin.testbench.TestBenchElement
A TestBench element representing a <table> element.
Since:
25.3
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns every row of this table, walking its sections in document order.
    Returns the <tbody> elements of this table, in document order.
    Returns the rows of this table's <tbody> elements, in document order.
    Returns this table's caption.
    getCell(int row, int column)
    Returns the cell at the given row and column of this table, with the row index running across the sections as in getAllRows().
    Returns the column groups of this table, in document order.
    Returns this table's <tfoot>.
    Returns the rows of this table's <tfoot>.
    Returns this table's <thead>.
    Returns the rows of this table's <thead>.
    getRow(int index)
    Returns the row at the given position in getAllRows(), so the index runs across the sections rather than within one.
    boolean
    Reports whether this table has a <caption>, without failing if it does not.
    boolean
    Reports whether this table has a <tfoot>, without failing if it does not.
    boolean
    Reports whether this table has a <thead>, without failing if it does not.

    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, scroll, scrollIntoView, scrollIntoView, scrollLeft, 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

    • TableElement

      public TableElement()
  • Method Details

    • getAllRows

      public List<TableRowElement> getAllRows()
      Returns every row of this table, walking its sections in document order. For a table rendered by Table that is the <thead> rows, then the rows of each <tbody>, then the <tfoot> rows; on a page that writes the sections in some other order, the result follows the markup rather than that order.

      The name matches Table.getAllRows(): this is the only row accessor here that spans every kind of section. getHeaderRows(), getBodyRows() and getFooterRows() each stay within one kind — though a table may have several <tbody> elements, so getBodyRows flattens those — and TableSectionElement.getRows() returns the rows of a single element.

      Returns:
      all the rows of this table.
    • getRow

      public TableRowElement getRow(int index)
      Returns the row at the given position in getAllRows(), so the index runs across the sections rather than within one.
      Parameters:
      index - the position of the row.
      Returns:
      the row at that position.
    • getCell

      public TableCellElement getCell(int row, int column)
      Returns the cell at the given row and column of this table, with the row index running across the sections as in getAllRows().
      Parameters:
      row - the position of the row.
      column - the position of the cell within that row.
      Returns:
      the cell at that position.
    • getHeaderRows

      public List<TableRowElement> getHeaderRows()
      Returns the rows of this table's <thead>.
      Returns:
      the header rows, or an empty list if the table has no <thead>.
    • getBodyRows

      public List<TableRowElement> getBodyRows()
      Returns the rows of this table's <tbody> elements, in document order. Use getBodies() to keep them grouped by body.
      Returns:
      the body rows, or an empty list if the table has no <tbody>.
    • getFooterRows

      public List<TableRowElement> getFooterRows()
      Returns the rows of this table's <tfoot>.
      Returns:
      the footer rows, or an empty list if the table has no <tfoot>.
    • getBodies

      public List<TableBodyElement> getBodies()
      Returns the <tbody> elements of this table, in document order. A table may have several, each holding its own rows.
      Returns:
      the table bodies.
    • getHead

      public TableHeadElement getHead()
      Returns this table's <thead>.
      Returns:
      the header section.
      Throws:
      org.openqa.selenium.NoSuchElementException - if the table has none. Ask hasHead() first to check without failing; getHeaderRows() is not the same question, since an empty <thead> has no rows.
    • hasHead

      public boolean hasHead()
      Reports whether this table has a <thead>, without failing if it does not.
      Returns:
      true if the section is present.
    • getFoot

      public TableFootElement getFoot()
      Returns this table's <tfoot>.
      Returns:
      the footer section.
      Throws:
      org.openqa.selenium.NoSuchElementException - if the table has none. Ask hasFoot() first to check without failing; getFooterRows() is not the same question, since an empty <tfoot> has no rows.
    • hasFoot

      public boolean hasFoot()
      Reports whether this table has a <tfoot>, without failing if it does not.
      Returns:
      true if the section is present.
    • getCaption

      public TableCaptionElement getCaption()
      Returns this table's caption.
      Returns:
      the <caption>.
      Throws:
      org.openqa.selenium.NoSuchElementException - if the table has none. Ask hasCaption() first to check without failing.
    • hasCaption

      public boolean hasCaption()
      Reports whether this table has a <caption>, without failing if it does not.
      Returns:
      true if the caption is present.
    • getColumnGroups

      public List<TableColumnGroupElement> getColumnGroups()
      Returns the column groups of this table, in document order.
      Returns:
      the table's <colgroup> elements.