Class MuiAutocomplete

  • All Implemented Interfaces:
    MuiComponent, 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
    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 INPUT_NAME
      The inner input component name
      static String NAME
      The component name
      • Fields inherited from class com.github.grossopa.selenium.core.component.DefaultWebComponent

        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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeOptions()  
      void deselectAll()  
      void deselectByIndex​(int index)  
      void deselectByValue​(String value)  
      void deselectByVisibleText​(String text)  
      List<com.github.grossopa.selenium.core.component.WebComponent> getAllSelectedOptions2()
      The selected options within the body, this method will only work under Multiple values model.
      MuiButton getClearButton()
      Finds the clear button, note the button might be not interactable if it's not shown.
      CloseOptionsAction getCloseOptionsAction()
      Gets the action for closing the options.
      String getComponentName()
      Gets the current component name
      org.openqa.selenium.WebElement getFirstSelectedOption()  
      com.github.grossopa.selenium.core.component.WebComponent getInput()
      Finds the input component within the Autocomplete.
      com.github.grossopa.selenium.core.component.WebComponent getLabel()
      Finds the input component within the Autocomplete.
      MuiModalFinder getModalFinder()
      Gets the modal finder for locating the popup modal / overlay.
      OpenOptionsAction getOpenOptionsAction()
      Gets the action for open the options.
      org.openqa.selenium.By getOptionLocator()
      Gets the option locator.
      List<com.github.grossopa.selenium.core.component.WebComponent> getOptions2()  
      MuiButton getPopupButton()
      Finds the popup button, note the button might be not interactable if it's not shown.
      MuiAutocompleteTagLocators getTagLocators()
      Gets the locators for tag component.
      boolean isEnabled()  
      boolean isMultiple()  
      boolean isNoOptions()
      Whether there is no options.
      com.github.grossopa.selenium.core.component.WebComponent openOptions()  
      void selectByIndex​(int index)  
      void selectByValue​(String value)  
      void selectByVisibleText​(String text)  
      • Methods inherited from class com.github.grossopa.selenium.core.component.DefaultWebComponent

        as, attributeContains, driver, findComponent, findComponentAs, findComponents, findComponentsAs, isFocused, outerHTML, to
      • Methods inherited from class com.github.grossopa.selenium.core.component.AbstractDelegatedWebElement

        clear, click, findElement, findElements, getAttribute, getCoordinates, getCssValue, getId, getLocation, getRect, getScreenshotAs, getSize, getTagName, getText, getWrappedDriver, getWrappedElement, isDisplayed, isSelected, sendKeys, submit, toString
      • Methods inherited from interface org.openqa.selenium.internal.HasIdentity

        getId
      • Methods inherited from interface org.openqa.selenium.interactions.Locatable

        getCoordinates
      • Methods inherited from interface com.github.grossopa.selenium.core.component.api.Select

        getAllSelectedOptions, getOptions
      • 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, getAttribute, getCssValue, getLocation, getRect, 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

      • 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
      • 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
      • 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.
      • openOptions

        public com.github.grossopa.selenium.core.component.WebComponent openOptions()
        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
      • 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
      • selectByVisibleText

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

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

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

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

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

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

        public void deselectByVisibleText​(String text)
        Specified by:
        deselectByVisibleText in interface org.openqa.selenium.support.ui.ISelect
      • 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.