class Select
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_HTML_SELECT |
protected WebElement |
element |
protected boolean |
isMulti |
Constructor and Description |
---|
Select(WebElement element)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
deselectAll()
Clear all selected entries.
|
void |
deselectByIndex(int index)
Deselect the option at the given index.
|
void |
deselectByValue(java.lang.String value)
Deselect all options that have a value matching the argument.
|
void |
deselectByVisibleText(java.lang.String text)
Deselect all options that display text matching the argument.
|
protected java.lang.String |
escapeQuotes(java.lang.String toEscape) |
java.util.List<WebElement> |
getAllSelectedOptions() |
WebElement |
getFirstSelectedOption() |
java.lang.Object |
getItemByIndex(int index) |
java.util.List<WebElement> |
getOptions() |
boolean |
isMultiple() |
protected boolean |
isSupported(WebElement element)
The element will be used to create an instance of class
Select or subclass. |
void |
selectByIndex(int index)
Select the option at the given index.
|
void |
selectByValue(java.lang.String value)
Select all options that have a value matching the argument.
|
void |
selectByVisibleText(java.lang.String text)
Select all options that display text matching the argument.
|
public static final java.lang.String CLASS_HTML_SELECT
protected final WebElement element
protected final boolean isMulti
public Select(WebElement element) throws SeleniumPlusException
isSupported(WebElement)
to see if element is supported.SeleniumPlusException.CODE_TYPE_IS_WRONG
.element
- SELECT element to wrapSeleniumPlusException
- when element is not supported as a combo box.protected boolean isSupported(WebElement element)
Select
or subclass. Select(WebElement)
or constructor of subclass,Select
or subclass.public java.lang.Object getItemByIndex(int index)
public boolean isMultiple()
public java.util.List<WebElement> getOptions()
public java.util.List<WebElement> getAllSelectedOptions()
public WebElement getFirstSelectedOption()
public void selectByVisibleText(java.lang.String text)
text
- The visible text to match againstpublic void selectByIndex(int index)
index
- The option at this index will be selectedpublic void selectByValue(java.lang.String value)
value
- The value to match againstpublic void deselectAll()
java.lang.UnsupportedOperationException
- If the SELECT does not support multiple selectionspublic void deselectByValue(java.lang.String value)
value
- The value to match againstpublic void deselectByIndex(int index)
index
- The option at this index will be deselectedpublic void deselectByVisibleText(java.lang.String text)
text
- The visible text to match againstprotected java.lang.String escapeQuotes(java.lang.String toEscape)