Modifier and Type | Field and Description |
---|---|
private org.openqa.selenium.WebElement |
element |
private boolean |
isMulti |
Constructor and Description |
---|
Select(org.openqa.selenium.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.
|
java.util.List<org.openqa.selenium.WebElement> |
getAllSelectedOptions() |
org.openqa.selenium.WebElement |
getFirstSelectedOption() |
private java.lang.String |
getLongestSubstringWithoutSpace(java.lang.String s) |
java.util.List<org.openqa.selenium.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.
|
private void |
setSelected(org.openqa.selenium.WebElement option,
boolean select)
Select or deselect specified option
|
private final org.openqa.selenium.WebElement element
private final boolean isMulti
public Select(org.openqa.selenium.WebElement element)
element
- SELECT element to wrapUnexpectedTagNameException
- when element is not a SELECTpublic boolean isMultiple()
isMultiple
in interface ISelect
public java.util.List<org.openqa.selenium.WebElement> getOptions()
getOptions
in interface ISelect
public java.util.List<org.openqa.selenium.WebElement> getAllSelectedOptions()
getAllSelectedOptions
in interface ISelect
public org.openqa.selenium.WebElement getFirstSelectedOption()
getFirstSelectedOption
in interface ISelect
org.openqa.selenium.NoSuchElementException
- If no option is selectedpublic void selectByVisibleText(java.lang.String text)
selectByVisibleText
in interface ISelect
text
- The visible text to match againstorg.openqa.selenium.NoSuchElementException
- If no matching option elements are foundprivate java.lang.String getLongestSubstringWithoutSpace(java.lang.String s)
public void selectByIndex(int index)
selectByIndex
in interface ISelect
index
- The option at this index will be selectedorg.openqa.selenium.NoSuchElementException
- If no matching option elements are foundpublic void selectByValue(java.lang.String value)
selectByValue
in interface ISelect
value
- The value to match againstorg.openqa.selenium.NoSuchElementException
- If no matching option elements are foundpublic void deselectAll()
deselectAll
in interface ISelect
java.lang.UnsupportedOperationException
- If the SELECT does not support multiple selectionspublic void deselectByValue(java.lang.String value)
deselectByValue
in interface ISelect
value
- The value to match againstorg.openqa.selenium.NoSuchElementException
- If no matching option elements are foundjava.lang.UnsupportedOperationException
- If the SELECT does not support multiple selectionspublic void deselectByIndex(int index)
deselectByIndex
in interface ISelect
index
- The option at this index will be deselectedorg.openqa.selenium.NoSuchElementException
- If no matching option elements are foundjava.lang.UnsupportedOperationException
- If the SELECT does not support multiple selectionspublic void deselectByVisibleText(java.lang.String text)
deselectByVisibleText
in interface ISelect
text
- The visible text to match againstorg.openqa.selenium.NoSuchElementException
- If no matching option elements are foundjava.lang.UnsupportedOperationException
- If the SELECT does not support multiple selectionsprivate void setSelected(org.openqa.selenium.WebElement option, boolean select)
option
- The option which state needs to be changedselect
- Indicates whether the option needs to be selected (true) or
deselected (false)