Class TimePickerElement

java.lang.Object
com.vaadin.testbench.TestBenchElement
com.vaadin.flow.component.timepicker.testbench.TimePickerElement
All Implemented Interfaces:
com.vaadin.testbench.commands.CanCompareScreenshots, com.vaadin.testbench.HasCallFunction, com.vaadin.testbench.HasClearButton, com.vaadin.testbench.HasDriver, com.vaadin.testbench.HasElementQuery, com.vaadin.testbench.HasHelper, com.vaadin.testbench.HasPropertySettersGetters, com.vaadin.testbench.HasSearchContext, com.vaadin.testbench.HasSelectByText, com.vaadin.testbench.HasStringValueProperty, com.vaadin.testbench.HasTestBenchCommandExecutor, com.vaadin.testbench.HasValidation, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.WebElement, org.openqa.selenium.WrapsElement

public class TimePickerElement extends com.vaadin.testbench.TestBenchElement implements com.vaadin.testbench.HasStringValueProperty, com.vaadin.testbench.HasSelectByText, com.vaadin.testbench.HasHelper, com.vaadin.testbench.HasClearButton, com.vaadin.testbench.HasValidation
A TestBench element representing a <vaadin-time-picker> element.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes the drop down for the time picker.
    com.vaadin.testbench.TestBenchElement
    getItem(int index)
    Gets the item at the given index from the drop down.
    getItemText(int index)
    Gets the text content for the item inside the drop down with the given index.
    com.vaadin.testbench.TestBenchElement
    Gets the last item inside the drop down.
    Gets the text content for the last item inside the drop down.
     
     
    com.vaadin.testbench.TestBenchElement
    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 overlay drop down.
    void
    sendKeys(CharSequence... keysToSend)
     

    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, getWrappedElement, hasAttribute, hasClassName, hashCode, hover, init, init, isChrome, isDisplayed, isEnabled, isFirefox, isFocused, isReadOnly, 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.HasCallFunction

    callFunction

    Methods inherited from interface com.vaadin.testbench.HasClearButton

    clickClearButton, isClearButtonVisible

    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 com.vaadin.testbench.HasValidation

    getErrorMessage, isInvalid, isRequired

    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

    • getTimePickerInputElement

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

      public String getText()
      Specified by:
      getText in interface org.openqa.selenium.WebElement
      Overrides:
      getText in class com.vaadin.testbench.TestBenchElement
    • getItem

      public com.vaadin.testbench.TestBenchElement getItem(int index)
      Gets the item at the given index from the drop down.

      NOTE: the time picker drop down should be opened with openDropDown() first.

      Parameters:
      index - the index of the item
      Returns:
      the item element
    • getLastItem

      public com.vaadin.testbench.TestBenchElement getLastItem()
      Gets the last item inside the drop down.

      NOTE: the time picker drop down should be opened with openDropDown() first.

      Returns:
      the last item element
    • 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.
    • 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 overlay 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 com.vaadin.testbench.HasSelectByText
      Parameters:
      timeInput - the time string to enter, not null
    • getSelectedText

      public String getSelectedText()
      Specified by:
      getSelectedText in interface com.vaadin.testbench.HasSelectByText
    • 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 com.vaadin.testbench.TestBenchElement