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.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 StringCOMPONENT_NAMEThe component namestatic StringINPUT_NAMEThe inner input 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()voidcloseOptions(Long delayInMillis)voiddeselectAll()voiddeselectAll(Long delayInMillis)voiddeselectByIndex(int index)voiddeselectByIndex(int index, Long delayInMillis)voiddeselectByValue(String value)voiddeselectByValue(String value, Long delayInMillis)voiddeselectByVisibleText(String text)voiddeselectByVisibleText(String text, Long delayInMillis)booleanequals(Object o)List<com.github.grossopa.selenium.core.component.WebComponent>getAllSelectedOptions2()The selected options within the body, this method will only work under Multiple values model.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.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()org.openqa.selenium.WebElementgetFirstSelectedOption(Long delayInMillis)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()List<com.github.grossopa.selenium.core.component.WebComponent>getOptions2(Long delayInMillis)MuiButtongetPopupButton()Finds the popup button, note the button might be not interactable if it's not shown.MuiAutocompleteTagLocatorsgetTagLocators()Gets the locators for tag component.inthashCode()booleanisEnabled()booleanisLoading()Whether the autocomplete is loading.booleanisMultiple()booleanisNoOptions()Whether there is no options.com.github.grossopa.selenium.core.component.WebComponentopenOptions()com.github.grossopa.selenium.core.component.WebComponentopenOptions(Long delayInMillis)voidselectByIndex(int index)voidselectByIndex(int index, Long delayInMillis)voidselectByValue(String value)voidselectByValue(String value, Long delayInMillis)voidselectByVisibleText(String text)voidselectByVisibleText(String text, Long delayInMillis)StringtoString()-
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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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
-
COMPONENT_NAME
public static final String COMPONENT_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
-
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:
getOptions2in interfacecom.github.grossopa.selenium.core.component.api.Select
-
getOptions2
public List<com.github.grossopa.selenium.core.component.WebComponent> getOptions2(Long delayInMillis)
- Specified by:
getOptions2in interfacecom.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:
getAllSelectedOptions2in interfacecom.github.grossopa.selenium.core.component.api.Select- Returns:
- the selected
MuiAutocompleteTagcomponents.
-
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. usegetAllSelectedOptions2()instead.- Specified by:
getAllSelectedOptions2in interfacecom.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:
openOptionsin interfacecom.github.grossopa.selenium.core.component.api.Select
-
openOptions
public com.github.grossopa.selenium.core.component.WebComponent openOptions(Long delayInMillis)
- Specified by:
openOptionsin interfacecom.github.grossopa.selenium.core.component.api.DelayedSelect
-
closeOptions
public void closeOptions()
- Specified by:
closeOptionsin interfacecom.github.grossopa.selenium.core.component.api.Select
-
closeOptions
public void closeOptions(Long delayInMillis)
- Specified by:
closeOptionsin interfacecom.github.grossopa.selenium.core.component.api.DelayedSelect
-
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
-
getFirstSelectedOption
public org.openqa.selenium.WebElement getFirstSelectedOption(Long delayInMillis)
- Specified by:
getFirstSelectedOptionin interfacecom.github.grossopa.selenium.core.component.api.DelayedSelect
-
selectByVisibleText
public void selectByVisibleText(String text)
- Specified by:
selectByVisibleTextin interfaceorg.openqa.selenium.support.ui.ISelect
-
selectByVisibleText
public void selectByVisibleText(String text, Long delayInMillis)
- Specified by:
selectByVisibleTextin interfacecom.github.grossopa.selenium.core.component.api.DelayedSelect
-
selectByIndex
public void selectByIndex(int index)
- Specified by:
selectByIndexin interfaceorg.openqa.selenium.support.ui.ISelect
-
selectByIndex
public void selectByIndex(int index, Long delayInMillis)- Specified by:
selectByIndexin interfacecom.github.grossopa.selenium.core.component.api.DelayedSelect
-
selectByValue
public void selectByValue(String value)
- Specified by:
selectByValuein interfaceorg.openqa.selenium.support.ui.ISelect
-
selectByValue
public void selectByValue(String value, Long delayInMillis)
- Specified by:
selectByValuein interfacecom.github.grossopa.selenium.core.component.api.DelayedSelect
-
deselectAll
public void deselectAll()
- Specified by:
deselectAllin interfaceorg.openqa.selenium.support.ui.ISelect
-
deselectAll
public void deselectAll(Long delayInMillis)
- Specified by:
deselectAllin interfacecom.github.grossopa.selenium.core.component.api.DelayedSelect
-
deselectByValue
public void deselectByValue(String value)
- Specified by:
deselectByValuein interfaceorg.openqa.selenium.support.ui.ISelect
-
deselectByValue
public void deselectByValue(String value, Long delayInMillis)
- Specified by:
deselectByValuein interfacecom.github.grossopa.selenium.core.component.api.DelayedSelect
-
deselectByIndex
public void deselectByIndex(int index)
- Specified by:
deselectByIndexin interfaceorg.openqa.selenium.support.ui.ISelect
-
deselectByIndex
public void deselectByIndex(int index, Long delayInMillis)- Specified by:
deselectByIndexin interfacecom.github.grossopa.selenium.core.component.api.DelayedSelect
-
deselectByVisibleText
public void deselectByVisibleText(String text)
- Specified by:
deselectByVisibleTextin interfaceorg.openqa.selenium.support.ui.ISelect
-
deselectByVisibleText
public void deselectByVisibleText(String text, Long delayInMillis)
- Specified by:
deselectByVisibleTextin interfacecom.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.
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classAbstractMuiComponent
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractMuiComponent
-
toString
public String toString()
- Overrides:
toStringin classAbstractMuiComponent
-
-