class WebDriverSelect (View source)

Models a SELECT tag, providing helper methods to select and deselect options.

Methods

__construct(WebDriverElement $element)

No description

bool
isMultiple()

No description

array
getOptions()

No description

array
getAllSelectedOptions()

No description

void
deselectAll()

Deselect all options in multiple select tag.

void
selectByIndex(int $index)

Select the option at the given index.

void
selectByValue(string $value)

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

void
selectByVisibleText(string $text)

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

void
deselectByIndex(int $index)

Deselect the option at the given index.

void
deselectByValue(string $value)

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

void
deselectByVisibleText(string $text)

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

string
escapeQuotes(string $to_escape)

Convert strings with both quotes and ticks into: foo'"bar -> concat("foo'", '"', "bar")

Details

__construct(WebDriverElement $element)

No description

Parameters

WebDriverElement $element

bool isMultiple()

No description

Return Value

bool

Whether this select element support selecting multiple options. This is done by checking the value of the 'multiple' attribute.

array getOptions()

No description

Return Value

array

All options belonging to this select tag.

array getAllSelectedOptions()

No description

Return Value

array

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)

void deselectAll()

Deselect all options in multiple select tag.

Return Value

void

void selectByIndex(int $index)

Select the option at the given index.

Parameters

int $index

The index of the option. (0-based)

Return Value

void

void selectByValue(string $value)

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

;

Parameters

string $value

The value to match against.

Return Value

void

void selectByVisibleText(string $text)

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

;

Parameters

string $text

The visible text to match against.

Return Value

void

void deselectByIndex(int $index)

Deselect the option at the given index.

Parameters

int $index

The index of the option. (0-based)

Return Value

void

void deselectByValue(string $value)

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

;

Parameters

string $value

The value to match against.

Return Value

void

void deselectByVisibleText(string $text)

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

;

Parameters

string $text

The visible text to match against.

Return Value

void

protected string escapeQuotes(string $to_escape)

Convert strings with both quotes and ticks into: foo'"bar -> concat("foo'", '"', "bar")

Parameters

string $to_escape

The string to be converted.

Return Value

string

The escaped string.