class WebDriverSelect implements WebDriverSelectInterface (View source)

Models a default HTML <select> tag, providing helper methods to select and deselect options.

Methods

__construct(WebDriverElement $element)

No description

bool
isMultiple()

No description

getOptions()

No description

selectByIndex(int $index)

Select the option at the given index.

selectByValue(string $value)

Select all options that have value attribute matching the argument. That is, when given "foo" this would select an option like:

selectByVisibleText(string $text)

Select all options that display text matching the argument. That is, when given "Bar" this would select an option like:

selectByVisiblePartialText(string $text)

Select all options that display text partially matching the argument. That is, when given "Bar" this would select an option like:

deselectAll()

Deselect all options in multiple select tag.

deselectByIndex(int $index)

Deselect the option at the given index.

deselectByValue(string $value)

Deselect all options that have value attribute matching the argument. That is, when given "foo" this would deselect an option like:

deselectByVisibleText(string $text)

Deselect all options that display text matching the argument. That is, when given "Bar" this would deselect an option like:

deselectByVisiblePartialText(string $text)

Deselect all options that display text matching the argument. That is, when given "Bar" this would deselect an option like:

selectOption(WebDriverElement $option)

Mark option selected

deselectOption(WebDriverElement $option)

Mark option not selected

Details

__construct(WebDriverElement $element)

No description

Parameters

WebDriverElement $element

bool isMultiple()

No description

Return Value

bool

Whether this select element support selecting multiple options.

WebDriverElement[] getOptions()

No description

Return Value

WebDriverElement[]

All options belonging to this select tag.

WebDriverElement[] getAllSelectedOptions()

No description

Return Value

WebDriverElement[]

All selected options belonging to this select tag.

WebDriverElement getFirstSelectedOption()

No description

Return Value

WebDriverElement

The first selected option in this select tag (or the currently selected option in a normal select)

Exceptions

NoSuchElementException

selectByIndex(int $index)

Select the option at the given index.

Parameters

int $index

The index of the option. (0-based)

Exceptions

NoSuchElementException

selectByValue(string $value)

Select all options that have value attribute matching the argument. That is, when given "foo" this would select an option like:

<option value="foo">Bar</option>

Parameters

string $value

The value to match against.

Exceptions

NoSuchElementException

selectByVisibleText(string $text)

Select all options that display text matching the argument. That is, when given "Bar" this would select an option like:

<option value="foo">Bar</option>

Parameters

string $text

The visible text to match against.

Exceptions

NoSuchElementException

selectByVisiblePartialText(string $text)

Select all options that display text partially matching the argument. That is, when given "Bar" this would select an option like:

<option value="bar">Foo Bar Baz</option>

Parameters

string $text

The visible text to match against.

Exceptions

NoSuchElementException

deselectAll()

Deselect all options in multiple select tag.

deselectByIndex(int $index)

Deselect the option at the given index.

Parameters

int $index

The index of the option. (0-based)

Exceptions

UnsupportedOperationException

deselectByValue(string $value)

Deselect all options that have value attribute matching the argument. That is, when given "foo" this would deselect an option like:

<option value="foo">Bar</option>

Parameters

string $value

The value to match against.

Exceptions

UnsupportedOperationException

deselectByVisibleText(string $text)

Deselect all options that display text matching the argument. That is, when given "Bar" this would deselect an option like:

<option value="foo">Bar</option>

Parameters

string $text

The visible text to match against.

Exceptions

UnsupportedOperationException

deselectByVisiblePartialText(string $text)

Deselect all options that display text matching the argument. That is, when given "Bar" this would deselect an option like:

<option value="foo">Foo Bar Baz</option>

Parameters

string $text

The visible text to match against.

Exceptions

UnsupportedOperationException

protected selectOption(WebDriverElement $option)

Mark option selected

Parameters

WebDriverElement $option

protected deselectOption(WebDriverElement $option)

Mark option not selected

Parameters

WebDriverElement $option