public class Select extends TypifiedElement
WebDriver
Select
and delegates
all method calls to it. But unlike WebDriver
Select
class there are no checks performed
in the constructor of this class, so it can be used correctly with lazy initialization mechanism.Constructor and Description |
---|
Select(org.openqa.selenium.WebElement wrappedElement)
Specifies wrapped
WebElement . |
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(String value)
Deselect all options that have a value matching the argument.
|
void |
deselectByVisibleText(String text)
Deselect all options that display text matching the argument.
|
List<org.openqa.selenium.WebElement> |
getAllSelectedOptions()
Returns all selected options belonging to this select tag.
|
org.openqa.selenium.WebElement |
getFirstSelectedOption()
The first selected option in this select tag (or the currently selected option in a normal select).
|
List<org.openqa.selenium.WebElement> |
getOptions()
Returns all options belonging to this select tag.
|
boolean |
hasSelectedOption()
Indicates if select has at least one selected option.
|
boolean |
isMultiple()
Indicates whether this select element support selecting multiple options at the same time.
|
void |
selectByIndex(int index)
Select the option at the given index.
|
void |
selectByValue(String value)
Select all options that have a value matching the argument.
|
void |
selectByVisibleText(String text)
Select all options that display text matching the argument.
|
clear, click, exists, findElement, findElements, getAttribute, getCssValue, getLocation, getName, getRect, getScreenshotAs, getSize, getTagName, getText, getWrappedElement, isDisplayed, isEnabled, isSelected, sendKeys, setName, submit, toString
public Select(org.openqa.selenium.WebElement wrappedElement)
WebElement
.
Performs no checks unlike Select
. All checks are made later
in getSelect()
method.wrappedElement
- WebElement
to wrap.public boolean isMultiple()
true
if select element support selecting multiple options and false
otherwise.public List<org.openqa.selenium.WebElement> getOptions()
WebElements
representing options.public List<org.openqa.selenium.WebElement> getAllSelectedOptions()
WebElements
representing selected options.public org.openqa.selenium.WebElement getFirstSelectedOption()
WebElement
representing selected option.public boolean hasSelectedOption()
true
if select has at least one selected option and false
otherwise.public void selectByVisibleText(String text)
text
- The visible text to match againstpublic void selectByIndex(int index)
index
- The option at this index will be selectedpublic void selectByValue(String value)
value
- The value to match againstpublic void deselectAll()
UnsupportedOperationException
- If the SELECT does not support multiple selectionspublic void deselectByValue(String value)
value
- The value to match againstpublic void deselectByIndex(int index)
index
- The option at this index will be deselectedpublic void deselectByVisibleText(String text)
text
- The visible text to match againstCopyright © 2019 Yandex. All rights reserved.