Class MuiAutocomplete
- java.lang.Object
-
- com.github.grossopa.selenium.core.component.AbstractDelegatedWebElement
-
- com.github.grossopa.selenium.core.component.DefaultWebComponent
-
- com.github.grossopa.selenium.component.mui.AbstractMuiComponent
-
- com.github.grossopa.selenium.component.mui.lab.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 StringINPUT_NAMEThe inner input component namestatic StringNAMEThe component name-
Fields inherited from class com.github.grossopa.selenium.component.mui.AbstractMuiComponent
config
-
-
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 driverMuiAutocomplete(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 driverMuiAutocomplete(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 driverMuiAutocomplete(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 voidcloseOptions()voiddeselectAll()voiddeselectByIndex(int index)voiddeselectByValue(String value)voiddeselectByVisibleText(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.MuiButtongetClearButton()Finds the clear button, note the button might be not interactable if it's not shown.CloseOptionsActiongetCloseOptionsAction()Gets the action for closing the options.StringgetComponentName()Gets the current component nameorg.openqa.selenium.WebElementgetFirstSelectedOption()com.github.grossopa.selenium.core.component.WebComponentgetInput()Finds the input component within the Autocomplete.com.github.grossopa.selenium.core.component.WebComponentgetLabel()Finds the input component within the Autocomplete.MuiModalFindergetModalFinder()Gets the modal finder for locating the popup modal / overlay.OpenOptionsActiongetOpenOptionsAction()Gets the action for open the options.org.openqa.selenium.BygetOptionLocator()Gets the option locator.List<com.github.grossopa.selenium.core.component.WebComponent>getOptions2()MuiButtongetPopupButton()Finds the popup button, note the button might be not interactable if it's not shown.MuiAutocompleteTagLocatorsgetTagLocators()Gets the locators for tag component.booleanisEnabled()booleanisMultiple()booleanisNoOptions()Whether there is no options.com.github.grossopa.selenium.core.component.WebComponentopenOptions()voidselectByIndex(int index)voidselectByValue(String value)voidselectByVisibleText(String text)-
Methods inherited from class com.github.grossopa.selenium.component.mui.AbstractMuiComponent
config, validate
-
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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.grossopa.selenium.core.component.api.Select
getAllSelectedOptions, getOptions
-
Methods inherited from interface com.github.grossopa.selenium.core.component.WebComponent
findElement, findElements
-
-
-
-
Field Detail
-
NAME
public static final String NAME
The component name- See Also:
- Constant Field Values
-
INPUT_NAME
public static final String INPUT_NAME
The inner input component name- See Also:
- Constant Field Values
-
-
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 elementdriver- the root driverconfig- 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 elementdriver- the root driverconfig- the Material UI configurationoptionLocator- 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 elementdriver- the root driverconfig- the Material UI configurationoptionLocator- optional, the locator for finding the optiontagLocators- 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 elementdriver- the root driverconfig- the Material UI configurationoptionLocator- optional, the locator for finding the optiontagLocators- optional for the multiple value tag locatorsopenOptionsAction- the action to open the optionscloseOptionsAction- the action to close the options
-
-
Method Detail
-
getComponentName
public String getComponentName()
Description copied from class:AbstractMuiComponentGets the current component name- Specified by:
getComponentNamein classAbstractMuiComponent- Returns:
- the current component name
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceorg.openqa.selenium.WebElement- Overrides:
isEnabledin classAbstractMuiComponent
-
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:
getOptions2in interfacecom.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:
getAllSelectedOptions2in interfacecom.github.grossopa.selenium.core.component.api.Select- Returns:
- the selected
MuiAutocompleteTagcomponents.
-
openOptions
public com.github.grossopa.selenium.core.component.WebComponent openOptions()
- Specified by:
openOptionsin interfacecom.github.grossopa.selenium.core.component.api.Select
-
closeOptions
public void closeOptions()
- Specified by:
closeOptionsin interfacecom.github.grossopa.selenium.core.component.api.Select
-
isMultiple
public boolean isMultiple()
- Specified by:
isMultiplein interfaceorg.openqa.selenium.support.ui.ISelect
-
getFirstSelectedOption
public org.openqa.selenium.WebElement getFirstSelectedOption()
- Specified by:
getFirstSelectedOptionin interfaceorg.openqa.selenium.support.ui.ISelect
-
selectByVisibleText
public void selectByVisibleText(String text)
- Specified by:
selectByVisibleTextin interfaceorg.openqa.selenium.support.ui.ISelect
-
selectByIndex
public void selectByIndex(int index)
- Specified by:
selectByIndexin interfaceorg.openqa.selenium.support.ui.ISelect
-
selectByValue
public void selectByValue(String value)
- Specified by:
selectByValuein interfaceorg.openqa.selenium.support.ui.ISelect
-
deselectAll
public void deselectAll()
- Specified by:
deselectAllin interfaceorg.openqa.selenium.support.ui.ISelect
-
deselectByValue
public void deselectByValue(String value)
- Specified by:
deselectByValuein interfaceorg.openqa.selenium.support.ui.ISelect
-
deselectByIndex
public void deselectByIndex(int index)
- Specified by:
deselectByIndexin interfaceorg.openqa.selenium.support.ui.ISelect
-
deselectByVisibleText
public void deselectByVisibleText(String text)
- Specified by:
deselectByVisibleTextin interfaceorg.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.
-
-