Class MuiSelect

  • All Implemented Interfaces:
    com.github.grossopa.selenium.core.component.api.Select, com.github.grossopa.selenium.core.component.WebComponent, org.openqa.selenium.interactions.Locatable, org.openqa.selenium.internal.HasIdentity, org.openqa.selenium.SearchContext, org.openqa.selenium.support.ui.ISelect, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.WebElement, org.openqa.selenium.WrapsDriver, org.openqa.selenium.WrapsElement

    public class MuiSelect
    extends AbstractMuiComponent
    implements com.github.grossopa.selenium.core.component.api.Select
    A MUI Select wrapper which supports the Popover-based options.

    The options are customized via a layer called popover which is in front of the page. hence there are no direct relationship between the component and options. In order to treat them still as one component, additional operations for opening the options are required before selecting an item.

    And, options show and hide usually requires a wait time for the animation, which introduce a bit more complexity for the framework to allow a wait time before actions such as getOptions2(Long). However, once the options are displayed, next operation doesn't necessarily require a wait time, e.g. another method could be invoked getOptions2() and immediately gets all the displayed items.

    Since:
    1.0
    Author:
    Jack Yin
    See Also:
    https://material-ui.com/components/selects/
    • Field Detail

      • DEFAULT_OPEN_OPTIONS_ACTION

        public static final OpenOptionsAction DEFAULT_OPEN_OPTIONS_ACTION
        The default action for opening the options
      • DEFAULT_CLOSE_OPTIONS_ACTION

        public static final CloseOptionsAction DEFAULT_CLOSE_OPTIONS_ACTION
        The default action for closing the options
    • Constructor Detail

      • MuiSelect

        public MuiSelect​(org.openqa.selenium.WebElement element,
                         com.github.grossopa.selenium.core.ComponentWebDriver driver,
                         MuiConfig config,
                         org.openqa.selenium.By optionsLocator)
        Constructs an instance with the delegated element and root driver.

        both Open option and Close option are default.

        Parameters:
        element - the delegated element
        driver - the root driver
        config - the Material UI configuration
        optionsLocator - the locator for finding the options
      • MuiSelect

        public MuiSelect​(org.openqa.selenium.WebElement element,
                         com.github.grossopa.selenium.core.ComponentWebDriver driver,
                         MuiConfig config,
                         org.openqa.selenium.By optionsLocator,
                         String optionValueAttribute)
        Constructs an instance with the delegated element and root driver
        Parameters:
        element - the delegated element
        driver - the root driver
        config - the Material UI configuration
        optionsLocator - the locator for finding the options
        optionValueAttribute - the value attribute of each option item
      • MuiSelect

        public MuiSelect​(org.openqa.selenium.WebElement element,
                         com.github.grossopa.selenium.core.ComponentWebDriver driver,
                         MuiConfig config,
                         org.openqa.selenium.By optionsLocator,
                         String optionValueAttribute,
                         OpenOptionsAction openOptionsAction,
                         CloseOptionsAction closeOptionsAction)
        Constructs an instance with the delegated element and root driver
        Parameters:
        element - the delegated element
        driver - the root driver
        config - the Material UI configuration
        optionsLocator - the locator for finding the options
        optionValueAttribute - the value attribute of each option item
        openOptionsAction - the action to open the options
        closeOptionsAction - the action to close the options
    • Method Detail

      • isMultiple

        public boolean isMultiple()
        Specified by:
        isMultiple in interface org.openqa.selenium.support.ui.ISelect
      • getOptions2

        public List<com.github.grossopa.selenium.core.component.WebComponent> getOptions2()
        Specified by:
        getOptions2 in interface com.github.grossopa.selenium.core.component.api.Select
      • getOptions2

        public List<com.github.grossopa.selenium.core.component.WebComponent> getOptions2​(Long delayInMillis)
        Specified by:
        getOptions2 in interface com.github.grossopa.selenium.core.component.api.Select
      • getAllSelectedOptions2

        public List<com.github.grossopa.selenium.core.component.WebComponent> getAllSelectedOptions2()
        Specified by:
        getAllSelectedOptions2 in interface com.github.grossopa.selenium.core.component.api.Select
      • getAllSelectedOptions2

        public List<com.github.grossopa.selenium.core.component.WebComponent> getAllSelectedOptions2​(Long delayInMillis)
        Specified by:
        getAllSelectedOptions2 in interface com.github.grossopa.selenium.core.component.api.Select
      • getOptions

        @Deprecated
        public List<org.openqa.selenium.WebElement> getOptions()
        Deprecated.
        Specified by:
        getOptions in interface org.openqa.selenium.support.ui.ISelect
        Specified by:
        getOptions in interface com.github.grossopa.selenium.core.component.api.Select
      • getAllSelectedOptions

        @Deprecated
        public List<org.openqa.selenium.WebElement> getAllSelectedOptions()
        Deprecated.
        Specified by:
        getAllSelectedOptions in interface org.openqa.selenium.support.ui.ISelect
        Specified by:
        getAllSelectedOptions in interface com.github.grossopa.selenium.core.component.api.Select
      • openOptions

        public com.github.grossopa.selenium.core.component.WebComponent openOptions()
        Specified by:
        openOptions in interface com.github.grossopa.selenium.core.component.api.Select
      • openOptions

        public com.github.grossopa.selenium.core.component.WebComponent openOptions​(Long delayInMillis)
        Specified by:
        openOptions in interface com.github.grossopa.selenium.core.component.api.Select
      • closeOptions

        public void closeOptions()
        Specified by:
        closeOptions in interface com.github.grossopa.selenium.core.component.api.Select
      • closeOptions

        public void closeOptions​(Long delayInMillis)
        Specified by:
        closeOptions in interface com.github.grossopa.selenium.core.component.api.Select
      • getFirstSelectedOption

        public org.openqa.selenium.WebElement getFirstSelectedOption()
        Specified by:
        getFirstSelectedOption in interface org.openqa.selenium.support.ui.ISelect
      • getFirstSelectedOption

        public org.openqa.selenium.WebElement getFirstSelectedOption​(Long delayInMillis)
        Specified by:
        getFirstSelectedOption in interface com.github.grossopa.selenium.core.component.api.Select
      • selectByVisibleText

        public void selectByVisibleText​(String text)
        Specified by:
        selectByVisibleText in interface org.openqa.selenium.support.ui.ISelect
      • selectByVisibleText

        public void selectByVisibleText​(String text,
                                        Long delayInMillis)
        Specified by:
        selectByVisibleText in interface com.github.grossopa.selenium.core.component.api.Select
      • selectByIndex

        public void selectByIndex​(int index)
        Specified by:
        selectByIndex in interface org.openqa.selenium.support.ui.ISelect
      • selectByIndex

        public void selectByIndex​(int index,
                                  Long delayInMillis)
        Specified by:
        selectByIndex in interface com.github.grossopa.selenium.core.component.api.Select
      • selectByValue

        public void selectByValue​(String value)
        Specified by:
        selectByValue in interface org.openqa.selenium.support.ui.ISelect
      • selectByValue

        public void selectByValue​(String value,
                                  Long delayInMillis)
        Specified by:
        selectByValue in interface com.github.grossopa.selenium.core.component.api.Select
      • deselectAll

        public void deselectAll()
        Specified by:
        deselectAll in interface org.openqa.selenium.support.ui.ISelect
      • deselectAll

        public void deselectAll​(Long delayInMillis)
        Specified by:
        deselectAll in interface com.github.grossopa.selenium.core.component.api.Select
      • deselectByValue

        public void deselectByValue​(String value)
        Specified by:
        deselectByValue in interface org.openqa.selenium.support.ui.ISelect
      • deselectByValue

        public void deselectByValue​(String value,
                                    Long delayInMillis)
        Specified by:
        deselectByValue in interface com.github.grossopa.selenium.core.component.api.Select
      • deselectByIndex

        public void deselectByIndex​(int index)
        Specified by:
        deselectByIndex in interface org.openqa.selenium.support.ui.ISelect
      • deselectByIndex

        public void deselectByIndex​(int index,
                                    Long delayInMillis)
        Specified by:
        deselectByIndex in interface com.github.grossopa.selenium.core.component.api.Select
      • deselectByVisibleText

        public void deselectByVisibleText​(String text)
        Specified by:
        deselectByVisibleText in interface org.openqa.selenium.support.ui.ISelect
      • deselectByVisibleText

        public void deselectByVisibleText​(String text,
                                          Long delayInMillis)
        Specified by:
        deselectByVisibleText in interface com.github.grossopa.selenium.core.component.api.Select
      • getOptionValueAttribute

        public String getOptionValueAttribute()
        Gets option value attribute.
        Returns:
        the option value attribute
      • getOptionsLocator

        public org.openqa.selenium.By getOptionsLocator()
        Gets options locator.
        Returns:
        the options locator
      • getOpenOptionsAction

        public OpenOptionsAction getOpenOptionsAction()
        Gets open options action.
        Returns:
        the open options action
      • getCloseOptionsAction

        public CloseOptionsAction getCloseOptionsAction()
        Gets close options action.
        Returns:
        the close options action