Class MuiSelect
- 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.inputs.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 invokedgetOptions2()and immediately gets all the displayed items.- Since:
- 1.0
- Author:
- Jack Yin
- See Also:
- https://material-ui.com/components/selects/
-
-
Field Summary
Fields Modifier and Type Field Description static CloseOptionsActionDEFAULT_CLOSE_OPTIONS_ACTIONThe default action for closing the optionsstatic OpenOptionsActionDEFAULT_OPEN_OPTIONS_ACTIONThe default action for opening the options-
Fields inherited from class com.github.grossopa.selenium.component.mui.AbstractMuiComponent
config
-
-
Constructor Summary
Constructors Constructor Description 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.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 driverMuiSelect(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
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated 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)List<org.openqa.selenium.WebElement>getAllSelectedOptions()Deprecated.List<com.github.grossopa.selenium.core.component.WebComponent>getAllSelectedOptions2()List<com.github.grossopa.selenium.core.component.WebComponent>getAllSelectedOptions2(Long delayInMillis)CloseOptionsActiongetCloseOptionsAction()Gets close options action.StringgetComponentName()Gets the current component nameorg.openqa.selenium.WebElementgetFirstSelectedOption()org.openqa.selenium.WebElementgetFirstSelectedOption(Long delayInMillis)OpenOptionsActiongetOpenOptionsAction()Gets open options action.List<org.openqa.selenium.WebElement>getOptions()Deprecated.List<com.github.grossopa.selenium.core.component.WebComponent>getOptions2()List<com.github.grossopa.selenium.core.component.WebComponent>getOptions2(Long delayInMillis)org.openqa.selenium.BygetOptionsLocator()Gets options locator.StringgetOptionValueAttribute()Gets option value attribute.booleanisMultiple()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)-
Methods inherited from class com.github.grossopa.selenium.component.mui.AbstractMuiComponent
isEnabled, validate
-
Methods inherited from class com.github.grossopa.selenium.core.component.DefaultWebComponent
as, attributeContains, findComponent, findComponentAs, findComponents, findComponentsAs, 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.WebComponent
findElement, findElements
-
-
-
-
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 elementdriver- the root driverconfig- the Material UI configurationoptionsLocator- 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 elementdriver- the root driverconfig- the Material UI configurationoptionsLocator- the locator for finding the optionsoptionValueAttribute- 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 elementdriver- the root driverconfig- the Material UI configurationoptionsLocator- the locator for finding the optionsoptionValueAttribute- the value attribute of each option itemopenOptionsAction- 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
-
isMultiple
public boolean isMultiple()
- Specified by:
isMultiplein interfaceorg.openqa.selenium.support.ui.ISelect
-
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.Select
-
getAllSelectedOptions2
public List<com.github.grossopa.selenium.core.component.WebComponent> getAllSelectedOptions2()
- Specified by:
getAllSelectedOptions2in interfacecom.github.grossopa.selenium.core.component.api.Select
-
getAllSelectedOptions2
public List<com.github.grossopa.selenium.core.component.WebComponent> getAllSelectedOptions2(Long delayInMillis)
- Specified by:
getAllSelectedOptions2in interfacecom.github.grossopa.selenium.core.component.api.Select
-
getOptions
@Deprecated public List<org.openqa.selenium.WebElement> getOptions()
Deprecated.- Specified by:
getOptionsin interfaceorg.openqa.selenium.support.ui.ISelect- Specified by:
getOptionsin interfacecom.github.grossopa.selenium.core.component.api.Select
-
getAllSelectedOptions
@Deprecated public List<org.openqa.selenium.WebElement> getAllSelectedOptions()
Deprecated.- Specified by:
getAllSelectedOptionsin interfaceorg.openqa.selenium.support.ui.ISelect- Specified by:
getAllSelectedOptionsin interfacecom.github.grossopa.selenium.core.component.api.Select
-
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.Select
-
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.Select
-
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.Select
-
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.Select
-
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.Select
-
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.Select
-
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.Select
-
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.Select
-
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.Select
-
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.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
-
-