Class DatePickerElement
java.lang.Object
com.vaadin.testbench.TestBenchElement
com.vaadin.flow.component.datepicker.testbench.DatePickerElement
- All Implemented Interfaces:
CanCompareScreenshots,HasCallFunction,HasClearButton,HasDriver,HasElementQuery,HasHelper,HasLabel,HasPropertySettersGetters,HasSearchContext,HasTestBenchCommandExecutor,HasValidation,org.openqa.selenium.SearchContext,org.openqa.selenium.TakesScreenshot,org.openqa.selenium.WebElement,org.openqa.selenium.WrapsElement
public class DatePickerElement
extends TestBenchElement
implements HasLabel, HasHelper, HasClearButton, HasValidation
A TestBench element representing a
<vaadin-date-picker>
element.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the value of the date picker.voidclose()Closes the date picker overlaygetDate()Gets the selected dateGets the visible presentation value from the inner input element as a string.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 pickerprotected StringgetValue()Gets the selected date as a string.booleanWhen auto open is enabled, the dropdown will open when the field is clicked.voidopen()Opens the date picker overlayvoidsendKeys(CharSequence... keysToSend) voidSelects the given date.voidsetInputValue(String value) Simulates the user selecting a date via the input element.protected voidSets 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, getDomAttribute, getDomProperty, 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, wrapElementsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.testbench.HasCallFunction
callFunctionMethods inherited from interface com.vaadin.testbench.HasClearButton
clickClearButton, isClearButtonVisibleMethods inherited from interface com.vaadin.testbench.HasElementQuery
$, $Methods inherited from interface com.vaadin.testbench.HasHelper
getHelperComponent, getHelperTextMethods inherited from interface com.vaadin.testbench.HasPropertySettersGetters
getProperty, getPropertyBoolean, getPropertyDouble, getPropertyElement, getPropertyElements, getPropertyInteger, getPropertyString, setProperty, setProperty, setProperty, setPropertyMethods inherited from interface com.vaadin.testbench.HasSearchContext
getContextMethods inherited from interface com.vaadin.testbench.HasValidation
getErrorMessage, isInvalid, isRequiredMethods inherited from interface org.openqa.selenium.TakesScreenshot
getScreenshotAsMethods 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 Details
-
DatePickerElement
public DatePickerElement()
-
-
Method Details
-
clear
public void clear()Clears the value of the date picker.- Specified by:
clearin interfaceorg.openqa.selenium.WebElement- Overrides:
clearin classTestBenchElement
-
setDate
Selects the given date.- Parameters:
date- the date to set
-
getDate
Gets the selected date- Returns:
- the selected date or
nullif no date is selected
-
setValue
Sets the selected date as a string.The value is always in format
YYYY-MM-DD.- Parameters:
value- the value to set
-
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
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 pressesEnterto commit the new date.- Parameters:
value- the date string to enter.
-
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:
trueif auto open is enabled.falseotherwise. Default istrue
-
open
public void open()Opens the date picker overlay -
close
public void close()Closes the date picker overlay -
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
- Specified by:
sendKeysin interfaceorg.openqa.selenium.WebElement- Overrides:
sendKeysin classTestBenchElement
-