Class TimePickerElement
java.lang.Object
com.vaadin.testbench.TestBenchElement
com.vaadin.flow.component.timepicker.testbench.TimePickerElement
- All Implemented Interfaces:
CanCompareScreenshots
,HasCallFunction
,HasDriver
,HasElementQuery
,HasHelper
,HasPropertySettersGetters
,HasSearchContext
,HasSelectByText
,HasStringValueProperty
,HasTestBenchCommandExecutor
,org.openqa.selenium.SearchContext
,org.openqa.selenium.TakesScreenshot
,org.openqa.selenium.WebElement
,org.openqa.selenium.WrapsElement
public class TimePickerElement
extends TestBenchElement
implements HasStringValueProperty, HasSelectByText, HasHelper
A TestBench element representing a
<vaadin-time-picker>
element.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A TestBench element representing<vaadin-time-picker-combo-box>
element inside the<vaadin-time-picker>
element.static class
A TestBench element representing<vaadin-time-picker-overlay>
element that contains the items for the<vaadin-time-picker>
element when the drop down has been opened withopenDropDown()
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes the drop down for the time picker.getItemText
(int index) Gets the text content for the item inside the drop down with the given index.Gets the text content for the last item inside the drop down.Gets the text of the currently selected option.getText()
Gets the<vaadin-time-picker-combo-box>
element inside the<vaadin-time-picker>
element.Gets the<input>
element inside the<vaadin-time-picker>
element.Gets the value property for the text field of the time picker.boolean
Gets whether dropdown will open automatically or not.void
Opens the drop down for the time picker.void
scrollToItem
(int index) Scrolls to the item with the given index in the time picker drop down.void
selectByText
(String timeInput) Simulates the user selecting a time via the input element.void
selectItemByIndex
(int index) Selects the item with the given index by clicking on the item from the combo box drop down.void
sendKeys
(CharSequence... keysToSend) void
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, getClassNames, getCommandExecutor, getContext, getCssValue, getDriver, getLocation, getProperty, getPropertyBoolean, getPropertyDouble, getPropertyElement, getPropertyElements, getPropertyInteger, getPropertyString, getRect, getScreenshotAs, getSize, getTagName, getWrappedElement, hasAttribute, hasClassName, hashCode, init, init, isChrome, isDisplayed, isEnabled, isFirefox, isSelected, scroll, scrollIntoView, scrollLeft, 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 com.vaadin.testbench.HasHelper
getHelperComponent, getHelperText
Methods inherited from interface com.vaadin.testbench.HasPropertySettersGetters
getProperty, getPropertyBoolean, getPropertyDouble, getPropertyElement, getPropertyElements, getPropertyInteger, getPropertyString, setProperty, setProperty, setProperty, setProperty
Methods inherited from interface com.vaadin.testbench.HasSearchContext
getContext
Methods inherited from interface com.vaadin.testbench.HasStringValueProperty
clear, getValue, setValue
Methods inherited from interface org.openqa.selenium.TakesScreenshot
getScreenshotAs
Methods inherited from interface org.openqa.selenium.WebElement
click, findElement, findElements, getAccessibleName, getAriaRole, getAttribute, getCssValue, getDomAttribute, getDomProperty, getLocation, getRect, getShadowRoot, getSize, getTagName, isDisplayed, isEnabled, isSelected, submit
-
Constructor Details
-
TimePickerElement
public TimePickerElement()
-
-
Method Details
-
getTimePickerComboBox
Gets the<vaadin-time-picker-combo-box>
element inside the<vaadin-time-picker>
element.- Returns:
- the combo box light element
-
getTimePickerInputElement
Gets the<input>
element inside the<vaadin-time-picker>
element.- Returns:
- the combo box light element
-
getText
- Specified by:
getText
in interfaceorg.openqa.selenium.WebElement
- Overrides:
getText
in classTestBenchElement
-
getItemText
Gets the text content for the item inside the drop down with the given index.NOTE: the time picker drop down should be opened with
openDropDown()
first.- Parameters:
index
- the index of the item- Returns:
- the text content for the item
-
getLastItemText
Gets the text content for the last item inside the drop down.NOTE: the time picker drop down should be opened with
openDropDown()
first.- Returns:
- the text content for the last item
-
getTimePickerInputValue
Gets the value property for the text field of the time picker.NOTE: this is not the same as the value property for the time picker, returned by
HasStringValueProperty.getValue()
.- Returns:
- the value of the text field inside the time picker
-
openDropDown
public void openDropDown()Opens the drop down for the time picker. -
waitUntilDropDownOpen
public void waitUntilDropDownOpen() -
closeDropDown
public void closeDropDown()Closes the drop down for the time picker. -
scrollToItem
public void scrollToItem(int index) Scrolls to the item with the given index in the time picker drop down.NOTE: the drop down must be opened before scrolling, e.g. use
openDropDown()
.- Parameters:
index
- the index of the item to scroll to
-
selectItemByIndex
public void selectItemByIndex(int index) Selects the item with the given index by clicking on the item from the combo box drop down.- Parameters:
index
- the index of the item to select
-
selectByText
Simulates the user selecting a time via the input element. This effectively clears the input element with a key shortcut, then types the given time string and finally pressesEnter
to commit the new time.- Specified by:
selectByText
in interfaceHasSelectByText
- Parameters:
timeInput
- the time string to enter, notnull
-
getSelectedText
Description copied from interface:HasSelectByText
Gets the text of the currently selected option.- Specified by:
getSelectedText
in interfaceHasSelectByText
- Returns:
- the text of the current option
-
isAutoOpen
public boolean isAutoOpen()Gets whether dropdown will open automatically or not.- Returns:
true
if enabled,false
otherwise
-
sendKeys
- Specified by:
sendKeys
in interfaceorg.openqa.selenium.WebElement
- Overrides:
sendKeys
in classTestBenchElement
-