Class MuiCalendarPicker
- java.lang.Object
-
- com.github.grossopa.selenium.core.component.AbstractDelegatedWebElement
-
- com.github.grossopa.selenium.core.component.DefaultWebComponent
-
- com.github.grossopa.selenium.component.mui.v4.AbstractMuiComponent
-
- com.github.grossopa.selenium.component.mui.v5.datetime.MuiCalendarPicker
-
- All Implemented Interfaces:
MuiComponent,com.github.grossopa.selenium.core.component.WebComponent,org.openqa.selenium.interactions.Locatable,org.openqa.selenium.SearchContext,org.openqa.selenium.TakesScreenshot,org.openqa.selenium.WebElement,org.openqa.selenium.WrapsDriver,org.openqa.selenium.WrapsElement
public class MuiCalendarPicker extends AbstractMuiComponent
The sub-component for user to be able to select date, month and year.- Since:
- 1.8
- Author:
- Jack Yin
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMuiCalendarPicker.ViewTypeThe view type of the calendar picker, either CalendarViewgetCalendarView()or YearPickergetYearPicker().
-
Field Summary
Fields Modifier and Type Field Description static StringCOMPONENT_NAMEthe component name-
Fields inherited from class com.github.grossopa.selenium.component.mui.v4.AbstractMuiComponent
config
-
-
Constructor Summary
Constructors Constructor Description MuiCalendarPicker(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config, List<MuiCalendarPicker.ViewType> views)Constructs an instance with the delegated element and root driverMuiCalendarPicker(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config, List<MuiCalendarPicker.ViewType> views, MonthStringFunction monthStringFunction)Constructs an instance with the delegated element, root driver and the string to month function to convert the displayed month string to actualMonth.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeView(MuiCalendarPicker.ViewType viewType)Switches the view based on the view type.voidchangeView(MuiCalendarPicker.ViewType viewType, long delayInMillis)Switches the view based on the view type.booleanequals(Object o)MuiCalendarViewgetCalendarView()Gets the main view as calendar view.StringgetComponentName()Gets the current component nameMuiCalendarPicker.ViewTypegetCurrentView()Tries to detect current view type by inner container.com.github.grossopa.selenium.core.component.WebComponentgetMonthLabel()Gets the month label, e.g.MuiMonthPickergetMonthPicker()Gets the main view as the month picker, It will not work if the month view is not shown.MonthStringFunctiongetMonthStringFunction()Gets the month string function.MuiButtongetNextMonthButton()Gets the next button ">"MuiButtongetPreviousMonthButton()Gets the previous button "<".MuiButtongetSwitchButton()Gets the switch button that can do from Calendar to Year switching.List<MuiCalendarPicker.ViewType>getViews()Gets the specified views of the picker.com.github.grossopa.selenium.core.component.WebComponentgetYearLabel()Gets the year label, e.g.MuiYearPickergetYearPicker()Gets the main view as year picker, It will not work when calendar selection is expanded.inthashCode()voidsetDate(java.time.LocalDate date)Selects the date.voidsetDate(java.time.LocalDate date, long delayInMillis)Selects the date.StringtoString()Set<MuiVersion>versions()Gets all the supported versions-
Methods inherited from class com.github.grossopa.selenium.component.mui.v4.AbstractMuiComponent
config, isEnabled, validate
-
Methods inherited from class com.github.grossopa.selenium.core.component.DefaultWebComponent
as, attributeContains, driver, findComponent, findComponentAs, findComponents, findComponentsAs, findTextNodes, getId, isFocused, outerHTML, styleContains, to
-
Methods inherited from class com.github.grossopa.selenium.core.component.AbstractDelegatedWebElement
clear, click, findElement, findElements, getAccessibleName, getAriaRole, getAttribute, getCoordinates, getCssValue, getDomAttribute, getDomProperty, getLocation, getRect, getScreenshotAs, getShadowRoot, getSize, getTagName, getText, getWrappedDriver, getWrappedElement, isDisplayed, isSelected, sendKeys, submit
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.grossopa.selenium.core.component.WebComponent
findElement, findElements
-
-
-
-
Field Detail
-
COMPONENT_NAME
public static final String COMPONENT_NAME
the component name- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MuiCalendarPicker
public MuiCalendarPicker(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config, List<MuiCalendarPicker.ViewType> views)Constructs an instance with the delegated element and root driver- Parameters:
element- the delegated elementdriver- the root driverconfig- the Material UI configurationviews- the view type sequence, defined by e.g. views={['year', 'day']}
-
MuiCalendarPicker
public MuiCalendarPicker(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config, List<MuiCalendarPicker.ViewType> views, MonthStringFunction monthStringFunction)Constructs an instance with the delegated element, root driver and the string to month function to convert the displayed month string to actualMonth.- Parameters:
element- the delegated elementdriver- the root driverconfig- the Material UI configurationviews- the view type sequence, defined by e.g. views={['year', 'day']}monthStringFunction- the monthStringFunction to convert
-
-
Method Detail
-
versions
public Set<MuiVersion> versions()
Description copied from interface:MuiComponentGets all the supported versions- Specified by:
versionsin interfaceMuiComponent- Overrides:
versionsin classAbstractMuiComponent- Returns:
- all the supported versions
-
getComponentName
public String getComponentName()
Description copied from class:AbstractMuiComponentGets the current component name- Specified by:
getComponentNamein classAbstractMuiComponent- Returns:
- the current component name
-
getMonthLabel
public com.github.grossopa.selenium.core.component.WebComponent getMonthLabel()
Gets the month label, e.g. October in English.- Returns:
- the month label container
-
getYearLabel
public com.github.grossopa.selenium.core.component.WebComponent getYearLabel()
Gets the year label, e.g. 2021- Returns:
- the year label container
-
getSwitchButton
public MuiButton getSwitchButton()
Gets the switch button that can do from Calendar to Year switching.- Returns:
- the switch button that can do from Calendar to Year switching.
-
getPreviousMonthButton
public MuiButton getPreviousMonthButton()
Gets the previous button "<".- Returns:
- the previous button
-
getNextMonthButton
public MuiButton getNextMonthButton()
Gets the next button ">"- Returns:
- the next button
-
getCalendarView
public MuiCalendarView getCalendarView()
Gets the main view as calendar view. It will not work when year selection is expanded.- Returns:
- the main view as calendar view.
-
getYearPicker
public MuiYearPicker getYearPicker()
Gets the main view as year picker, It will not work when calendar selection is expanded.- Returns:
- the main view as year picker.
-
getMonthPicker
public MuiMonthPicker getMonthPicker()
Gets the main view as the month picker, It will not work if the month view is not shown.- Returns:
- the main view as month picker.
-
setDate
public void setDate(java.time.LocalDate date)
Selects the date.- Parameters:
date- the date to select
-
setDate
public void setDate(java.time.LocalDate date, long delayInMillis)Selects the date.- Parameters:
date- the date to selectdelayInMillis- the delaying in milliseconds for switching between year and calendar view, suggested value is 500.
-
changeView
public void changeView(MuiCalendarPicker.ViewType viewType)
Switches the view based on the view type. Does nothing if it's already displayed.- Parameters:
viewType- the view type to switch to
-
changeView
public void changeView(MuiCalendarPicker.ViewType viewType, long delayInMillis)
Switches the view based on the view type. Does nothing if it's already displayed.- Parameters:
viewType- the view type to switch todelayInMillis- the delays for animation, suggested value is 500
-
getCurrentView
public MuiCalendarPicker.ViewType getCurrentView()
Tries to detect current view type by inner container.- Returns:
- the current view type
-
getViews
public List<MuiCalendarPicker.ViewType> getViews()
Gets the specified views of the picker.- Returns:
- the specified views of the picker.
-
getMonthStringFunction
public MonthStringFunction getMonthStringFunction()
Gets the month string function.- Returns:
- the month string function.
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classAbstractMuiComponent
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractMuiComponent
-
toString
public String toString()
- Overrides:
toStringin classAbstractMuiComponent
-
-