public class Select
extends java.lang.Object
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.util.List<WebElement> |
getOptions() |
boolean |
isMultiple() |
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 Select(WebElement element)
element
- SELECT element to wrapUnexpectedTagNameException
- when element is not a SELECTpublic boolean isMultiple()
public java.util.List<WebElement> getOptions()
public java.util.List<WebElement> getAllSelectedOptions()
public WebElement getFirstSelectedOption()
NoSuchElementException
- If no option is selectedpublic void selectByVisibleText(java.lang.String text)
text
- The visible text to match againstNoSuchElementException
- If no matching option elements are foundpublic void selectByIndex(int index)
index
- The option at this index will be selectedNoSuchElementException
- If no matching option elements are foundpublic void selectByValue(java.lang.String value)
value
- The value to match againstNoSuchElementException
- If no matching option elements are foundpublic void deselectAll()
java.lang.UnsupportedOperationException
- If the SELECT does not support multiple selectionspublic void deselectByValue(java.lang.String value)
value
- The value to match againstNoSuchElementException
- If no matching option elements are foundpublic void deselectByIndex(int index)
index
- The option at this index will be deselectedNoSuchElementException
- If no matching option elements are foundpublic void deselectByVisibleText(java.lang.String text)
text
- The visible text to match againstNoSuchElementException
- If no matching option elements are foundprotected java.lang.String escapeQuotes(java.lang.String toEscape)