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

    • TimePickerElement

      public TimePickerElement()
  • Method Details

    • getTimePickerComboBox

      public TimePickerElement.TimePickerComboBoxElement getTimePickerComboBox()
      Gets the <vaadin-time-picker-combo-box> element inside the <vaadin-time-picker> element.
      Returns:
      the combo box light element
    • getTimePickerInputElement

      public TestBenchElement getTimePickerInputElement()
      Gets the <input> element inside the <vaadin-time-picker> element.
      Returns:
      the combo box light element
    • getText

      public String getText()
      Specified by:
      getText in interface org.openqa.selenium.WebElement
      Overrides:
      getText in class TestBenchElement
    • getItemText

      public String getItemText(int index)
      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

      public String 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

      public String 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

      public void selectByText(String timeInput)
      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 presses Enter to commit the new time.
      Specified by:
      selectByText in interface HasSelectByText
      Parameters:
      timeInput - the time string to enter, not null
    • getSelectedText

      public String getSelectedText()
      Description copied from interface: HasSelectByText
      Gets the text of the currently selected option.
      Specified by:
      getSelectedText in interface HasSelectByText
      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

      public void sendKeys(CharSequence... keysToSend)
      Specified by:
      sendKeys in interface org.openqa.selenium.WebElement
      Overrides:
      sendKeys in class TestBenchElement