Package com.vaadin.testbench.elements
Class TreeElement
- java.lang.Object
-
- com.vaadin.testbench.AbstractHasTestBenchCommandExecutor
-
- com.vaadin.testbench.TestBenchElement
-
- com.vaadin.testbench.elementsbase.AbstractElement
-
- com.vaadin.testbench.elements.AbstractComponentElement
-
- com.vaadin.testbench.elements.TreeElement
-
- All Implemented Interfaces:
com.vaadin.testbench.commands.CanCompareScreenshots,com.vaadin.testbench.commands.CanWaitForVaadin,com.vaadin.testbench.commands.TestBenchElementCommands,com.vaadin.testbench.HasDriver,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 TreeElement extends AbstractComponentElement
Testbench Element API forTree.Note: This TreeElement is for the Vaadin 8 version of Tree. Use
TreeElementfor the compatibility version.- Since:
- 8.1
- Author:
- Vaadin Ltd.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.testbench.elements.AbstractComponentElement
AbstractComponentElement.ReadOnlyException
-
-
Constructor Summary
Constructors Constructor Description TreeElement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TreeGridElementasTreeGrid()Convenience method for accessing the underlying TreeGrid.voidcollapse(int index)Collapses the row at the given index in the tree.voidexpand(int index)Expands the row at the given index in the tree.protected com.vaadin.testbench.TestBenchElementfindCellContentFromRow(org.openqa.selenium.WebElement rowElement)Finds the rendered cell content from given row element.List<com.vaadin.testbench.TestBenchElement>getAllItems()Gets all items currently shown in this tree.org.openqa.selenium.WebElementgetExpandElement(int rowIndex)Gets the expand/collapse element for the given row.com.vaadin.testbench.TestBenchElementgetItem(int index)Gets an item at given index.booleanisCollapsed(int rowIndex)Returns whether the row at the given index is collapsed or not.booleanisExpanded(int index)Returns whether the row at the given index is expanded or not.-
Methods inherited from class com.vaadin.testbench.elements.AbstractComponentElement
getCaption, getHTML, getStyleAttribute, isReadOnly
-
Methods inherited from class com.vaadin.testbench.TestBenchElement
clear, click, click, clickHiddenElement, compareScreen, compareScreen, compareScreen, contextClick, doubleClick, equals, findElement, findElements, focus, getAccessibleName, getAriaRole, getAttribute, getCapabilities, getClassNames, getCommandExecutor, getContext, getCssValue, getDomAttribute, getDriver, getId, getLocation, getRect, getScreenshotAs, getShadowRoot, getSize, getTagName, getText, getWrappedElement, hasAttribute, hasClassName, hashCode, init, init, isChrome, isDisplayed, isEnabled, isFirefox, isFocused, isSelected, scroll, scrollIntoView, scrollLeft, sendKeys, showTooltip, submit, waitForVaadin, waitUntil, waitUntil, wrap, wrapElement, wrapElements
-
Methods inherited from class com.vaadin.testbench.AbstractHasTestBenchCommandExecutor
$, $$, isElementPresent, isElementPresent
-
-
-
-
Method Detail
-
expand
public void expand(int index)
Expands the row at the given index in the tree.- Parameters:
index- 0-based row index to expand
-
isExpanded
public boolean isExpanded(int index)
Returns whether the row at the given index is expanded or not.- Parameters:
index- 0-based row index- Returns:
trueif expanded,falseif collapsed
-
isCollapsed
public boolean isCollapsed(int rowIndex)
Returns whether the row at the given index is collapsed or not.- Parameters:
rowIndex- 0-based row index- Returns:
trueif collapsed,falseif expanded
-
getExpandElement
public org.openqa.selenium.WebElement getExpandElement(int rowIndex)
Gets the expand/collapse element for the given row.- Parameters:
rowIndex- 0-based row index- Returns:
- the
spanelement that is clicked for expanding/collapsing a row - Throws:
org.openqa.selenium.NoSuchElementException- if there is no expand element for this row
-
collapse
public void collapse(int index)
Collapses the row at the given index in the tree.- Parameters:
index- 0-based row index to collapse
-
getAllItems
public List<com.vaadin.testbench.TestBenchElement> getAllItems()
Gets all items currently shown in this tree. The returned element objects are the rendered contents for each item.- Returns:
- list of content elements for all items
-
getItem
public com.vaadin.testbench.TestBenchElement getItem(int index)
Gets an item at given index. The returned element object is the rendered content in the given index.- Parameters:
index- 0-based row index- Returns:
- content element for item at given index
-
findCellContentFromRow
protected com.vaadin.testbench.TestBenchElement findCellContentFromRow(org.openqa.selenium.WebElement rowElement)
Finds the rendered cell content from given row element. This expects the row to contain only a single column rendered with TreeRenderer.- Parameters:
rowElement- the row element- Returns:
- cell content element
-
asTreeGrid
protected TreeGridElement asTreeGrid()
Convenience method for accessing the underlying TreeGrid.- Returns:
- this tree element as a tree grid element.
-
-