Class DatePickerElement

  • 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.HasLabel, com.vaadin.testbench.HasPropertySettersGetters, com.vaadin.testbench.HasSearchContext, 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 DatePickerElement
    extends com.vaadin.testbench.TestBenchElement
    implements com.vaadin.testbench.HasLabel, com.vaadin.testbench.HasHelper, com.vaadin.testbench.HasValidation, com.vaadin.testbench.HasClearButton
    A TestBench element representing a <vaadin-date-picker> element.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears the value of the date picker.
      void close()
      Closes the date picker overlay
      LocalDate getDate()
      Gets the selected date
      String getInputValue()
      Gets the visible presentation value from the inner input element as a string.
      DatePickerElement.OverlayContentElement getOverlayContent()
      Gets the content of the first date picker overlay on the page Should only be used with a single date picker at a time, there is no check that the overlay belongs to this specific date picker
      protected String getValue()
      Gets the selected date as a string.
      boolean isAutoOpen()
      When auto open is enabled, the dropdown will open when the field is clicked.
      void open()
      Opens the date picker overlay
      void sendKeys​(CharSequence... keysToSend)  
      void setDate​(LocalDate date)
      Selects the given date.
      void setInputValue​(String value)
      Simulates the user selecting a date via the input element.
      protected void setValue​(String value)
      Sets the selected date as a string.
      • Methods inherited from class com.vaadin.testbench.TestBenchElement

        callFunction, click, click, compareScreen, compareScreen, compareScreen, contextClick, dispatchEvent, dispatchEvent, doubleClick, equals, executeScript, findElement, findElements, focus, getAttribute, getCapabilities, getChildren, getClassNames, getCommandExecutor, getContext, getCssValue, 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, scrollLeft, setProperty, setProperty, setProperty, setProperty, submit, waitForVaadin, waitUntil, waitUntil, wrap, wrapElement, wrapElements
      • 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.HasLabel

        getLabel
      • 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.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, getText, isDisplayed, isEnabled, isSelected, submit
    • Constructor Detail

      • DatePickerElement

        public DatePickerElement()
    • Method Detail

      • clear

        public void clear()
        Clears the value of the date picker.
        Specified by:
        clear in interface org.openqa.selenium.WebElement
        Overrides:
        clear in class com.vaadin.testbench.TestBenchElement
      • setDate

        public void setDate​(LocalDate date)
        Selects the given date.
        Parameters:
        date - the date to set
      • getDate

        public LocalDate getDate()
        Gets the selected date
        Returns:
        the selected date or null if no date is selected
      • setValue

        protected void setValue​(String value)
        Sets the selected date as a string.

        The value is always in format YYYY-MM-DD.

        Parameters:
        value - the value to set
      • getValue

        protected String getValue()
        Gets the selected date as a string.

        The value is always in format YYYY-MM-DD.

        Returns:
        the value of the date picker or an empty string if no date is selected
      • setInputValue

        public void setInputValue​(String value)
        Simulates the user selecting a date via the input element. This effectively clears the input element with a key shortcut, then types the given date string and finally presses Enter to commit the new date.
        Parameters:
        value - the date string to enter.
      • getInputValue

        public String getInputValue()
        Gets the visible presentation value from the inner input element as a string. This value depends on the used Locale.
        Returns:
      • isAutoOpen

        public boolean isAutoOpen()
        When auto open is enabled, the dropdown will open when the field is clicked.
        Returns:
        true if auto open is enabled. false otherwise. Default is true
      • open

        public void open()
        Opens the date picker overlay
      • close

        public void close()
        Closes the date picker overlay
      • getOverlayContent

        public DatePickerElement.OverlayContentElement getOverlayContent()
        Gets the content of the first date picker overlay on the page Should only be used with a single date picker at a time, there is no check that the overlay belongs to this specific date picker
        Returns:
      • sendKeys

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