Class MuiAutocomplete

  • All Implemented Interfaces:
    MuiComponent, com.github.grossopa.selenium.core.component.api.DelayedSelect, 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 MuiAutocomplete
    extends AbstractMuiComponent
    implements com.github.grossopa.selenium.core.component.api.Select, com.github.grossopa.selenium.core.component.api.DelayedSelect
    The autocomplete is a normal text input enhanced by a panel of suggested options.
    Since:
    1.3
    Author:
    Jack Yin
    See Also:
    https://material-ui.com/components/autocomplete/
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String COMPONENT_NAME
      The component name
      static String INPUT_NAME
      The inner input 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
      MuiAutocomplete​(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config)
      Constructs an instance with the delegated element and root driver
      MuiAutocomplete​(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config, org.openqa.selenium.By optionLocator)
      Constructs an instance with the delegated element and root driver
      MuiAutocomplete​(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config, org.openqa.selenium.By optionLocator, MuiAutocompleteTagLocators tagLocators)
      Constructs an instance with the delegated element and root driver
      MuiAutocomplete​(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config, org.openqa.selenium.By optionLocator, MuiAutocompleteTagLocators tagLocators, OpenOptionsAction openOptionsAction, CloseOptionsAction closeOptionsAction)
      Constructs an instance with the delegated element and root driver
    • Constructor Detail

      • MuiAutocomplete

        public MuiAutocomplete​(org.openqa.selenium.WebElement element,
                               com.github.grossopa.selenium.core.ComponentWebDriver driver,
                               MuiConfig config)
        Constructs an instance with the delegated element and root driver
        Parameters:
        element - the delegated element
        driver - the root driver
        config - the Material UI configuration
      • MuiAutocomplete

        public MuiAutocomplete​(org.openqa.selenium.WebElement element,
                               com.github.grossopa.selenium.core.ComponentWebDriver driver,
                               MuiConfig config,
                               @Nullable
                               org.openqa.selenium.By optionLocator)
        Constructs an instance with the delegated element and root driver
        Parameters:
        element - the delegated element
        driver - the root driver
        config - the Material UI configuration
        optionLocator - optional, the locator for finding the option
      • MuiAutocomplete

        public MuiAutocomplete​(org.openqa.selenium.WebElement element,
                               com.github.grossopa.selenium.core.ComponentWebDriver driver,
                               MuiConfig config,
                               @Nullable
                               org.openqa.selenium.By optionLocator,
                               @Nullable
                               MuiAutocompleteTagLocators tagLocators)
        Constructs an instance with the delegated element and root driver
        Parameters:
        element - the delegated element
        driver - the root driver
        config - the Material UI configuration
        optionLocator - optional, the locator for finding the option
        tagLocators - optional for the multiple value tag locators
      • MuiAutocomplete

        public MuiAutocomplete​(org.openqa.selenium.WebElement element,
                               com.github.grossopa.selenium.core.ComponentWebDriver driver,
                               MuiConfig config,
                               @Nullable
                               org.openqa.selenium.By optionLocator,
                               @Nullable
                               MuiAutocompleteTagLocators tagLocators,
                               @Nullable
                               OpenOptionsAction openOptionsAction,
                               @Nullable
                               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
        optionLocator - optional, the locator for finding the option
        tagLocators - optional for the multiple value tag locators
        openOptionsAction - the action to open the options
        closeOptionsAction - the action to close the options
    • Method Detail

      • isEnabled

        public boolean isEnabled()
        Specified by:
        isEnabled in interface org.openqa.selenium.WebElement
        Overrides:
        isEnabled in class AbstractMuiComponent
      • isLoading

        public boolean isLoading()
        Whether the autocomplete is loading.
        Returns:
        true if the autocomplete is loading the data from backend.
      • getLabel

        public com.github.grossopa.selenium.core.component.WebComponent getLabel()
        Finds the input component within the Autocomplete.
        Returns:
        the input component within the Autocomplete.
      • getInput

        public com.github.grossopa.selenium.core.component.WebComponent getInput()
        Finds the input component within the Autocomplete.
        Returns:
        the input component within the Autocomplete.
      • getClearButton

        public MuiButton getClearButton()
        Finds the clear button, note the button might be not interactable if it's not shown.
        Returns:
        the clear button
      • getPopupButton

        public MuiButton getPopupButton()
        Finds the popup button, note the button might be not interactable if it's not shown.
        Returns:
        the popup button
      • 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.DelayedSelect
      • getAllSelectedOptions2

        public List<com.github.grossopa.selenium.core.component.WebComponent> getAllSelectedOptions2()
        The selected options within the body, this method will only work under Multiple values model.
        Specified by:
        getAllSelectedOptions2 in interface com.github.grossopa.selenium.core.component.api.Select
        Returns:
        the selected MuiAutocompleteTag components.
      • getAllSelectedOptions2

        public List<com.github.grossopa.selenium.core.component.WebComponent> getAllSelectedOptions2​(Long delayInMillis)
        Gets the selected Options within the body, however the delay is not necessary as the tags are always displaying. use getAllSelectedOptions2() instead.
        Specified by:
        getAllSelectedOptions2 in interface com.github.grossopa.selenium.core.component.api.DelayedSelect
        Parameters:
        delayInMillis - no-use, the delays in milliseconds
        Returns:
        the found tags
      • 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.DelayedSelect
      • 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.DelayedSelect
      • isMultiple

        public boolean isMultiple()
        Specified by:
        isMultiple in interface org.openqa.selenium.support.ui.ISelect
      • 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.DelayedSelect
      • 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.DelayedSelect
      • 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.DelayedSelect
      • 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.DelayedSelect
      • 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.DelayedSelect
      • 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.DelayedSelect
      • 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.DelayedSelect
      • 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.DelayedSelect
      • isNoOptions

        public boolean isNoOptions()
        Whether there is no options.
        Returns:
        true if there is no options and "No Options" is shown.
      • getModalFinder

        public MuiModalFinder getModalFinder()
        Gets the modal finder for locating the popup modal / overlay.
        Returns:
        the modal finder instance.
      • getOptionLocator

        public org.openqa.selenium.By getOptionLocator()
        Gets the option locator.
        Returns:
        the option locator.
      • getOpenOptionsAction

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

        public CloseOptionsAction getCloseOptionsAction()
        Gets the action for closing the options.
        Returns:
        the action for closing the options.
      • getTagLocators

        public MuiAutocompleteTagLocators getTagLocators()
        Gets the locators for tag component.
        Returns:
        the locators for tag component.