Class 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String COMPONENT_NAME
      the component name
      • Fields inherited from class com.github.grossopa.selenium.core.component.DefaultWebComponent

        decorator, driver
      • Fields inherited from class com.github.grossopa.selenium.core.component.AbstractDelegatedWebElement

        element
    • 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 driver
      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 actual Month.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void changeView​(MuiCalendarPicker.ViewType viewType)
      Switches the view based on the view type.
      void changeView​(MuiCalendarPicker.ViewType viewType, long delayInMillis)
      Switches the view based on the view type.
      boolean equals​(Object o)  
      MuiCalendarView getCalendarView()
      Gets the main view as calendar view.
      String getComponentName()
      Gets the current component name
      MuiCalendarPicker.ViewType getCurrentView()
      Tries to detect current view type by inner container.
      com.github.grossopa.selenium.core.component.WebComponent getMonthLabel()
      Gets the month label, e.g.
      MuiMonthPicker getMonthPicker()
      Gets the main view as the month picker, It will not work if the month view is not shown.
      MonthStringFunction getMonthStringFunction()
      Gets the month string function.
      MuiButton getNextMonthButton()
      Gets the next button ">"
      MuiButton getPreviousMonthButton()
      Gets the previous button "<".
      MuiButton getSwitchButton()
      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.WebComponent getYearLabel()
      Gets the year label, e.g.
      MuiYearPicker getYearPicker()
      Gets the main view as year picker, It will not work when calendar selection is expanded.
      int hashCode()  
      void setDate​(java.time.LocalDate date)
      Selects the date.
      void setDate​(java.time.LocalDate date, long delayInMillis)
      Selects the date.
      String toString()  
      Set<MuiVersion> versions()
      Gets all the supported versions
      • 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 interface org.openqa.selenium.interactions.Locatable

        getCoordinates
      • Methods inherited from interface org.openqa.selenium.TakesScreenshot

        getScreenshotAs
      • Methods inherited from interface com.github.grossopa.selenium.core.component.WebComponent

        findElement, findElements
      • Methods inherited from interface org.openqa.selenium.WebElement

        clear, click, getAccessibleName, getAriaRole, getAttribute, getCssValue, getDomAttribute, getDomProperty, getLocation, getRect, getShadowRoot, getSize, getTagName, getText, isDisplayed, isSelected, sendKeys, submit
      • Methods inherited from interface org.openqa.selenium.WrapsDriver

        getWrappedDriver
      • Methods inherited from interface org.openqa.selenium.WrapsElement

        getWrappedElement
    • 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 element
        driver - the root driver
        config - the Material UI configuration
        views - 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 actual Month.
        Parameters:
        element - the delegated element
        driver - the root driver
        config - the Material UI configuration
        views - the view type sequence, defined by e.g. views={['year', 'day']}
        monthStringFunction - the monthStringFunction to convert
    • Method Detail

      • 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 select
        delayInMillis - 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 to
        delayInMillis - 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
      • getMonthStringFunction

        public MonthStringFunction getMonthStringFunction()
        Gets the month string function.
        Returns:
        the month string function.