1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
// Copyright 2004-present Facebook. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace Facebook\WebDriver;
use Facebook\WebDriver\Exception\NoSuchElementException;
use Facebook\WebDriver\Exception\UnsupportedOperationException;
/**
* Models an element of select type, providing helper methods to select and deselect options.
*/
interface WebDriverSelectInterface
{
/**
* @return bool Whether this select element support selecting multiple options.
*/
public function isMultiple();
/**
* @return WebDriverElement[] All options belonging to this select tag.
*/
public function getOptions();
/**
* @return WebDriverElement[] All selected options belonging to this select tag.
*/
public function getAllSelectedOptions();
/**
* @throws NoSuchElementException
*
* @return WebDriverElement The first selected option in this select tag (or the currently selected option in a
* normal select)
*/
public function getFirstSelectedOption();
/**
* Select the option at the given index.
*
* @param int $index The index of the option. (0-based)
*
* @throws NoSuchElementException
*/
public function selectByIndex($index);
/**
* 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>`
*
* @param string $value The value to match against.
*
* @throws NoSuchElementException
*/
public function selectByValue($value);
/**
* 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>`
*
* @param string $text The visible text to match against.
*
* @throws NoSuchElementException
*/
public function selectByVisibleText($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>`
*
* @param string $text The visible text to match against.
*
* @throws NoSuchElementException
*/
public function selectByVisiblePartialText($text);
/**
* Deselect all options in multiple select tag.
*
* @throws UnsupportedOperationException If the SELECT does not support multiple selections
*/
public function deselectAll();
/**
* Deselect the option at the given index.
*
* @param int $index The index of the option. (0-based)
* @throws UnsupportedOperationException If the SELECT does not support multiple selections
*/
public function deselectByIndex($index);
/**
* 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>`
*
* @param string $value The value to match against.
* @throws UnsupportedOperationException If the SELECT does not support multiple selections
*/
public function deselectByValue($value);
/**
* 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>`
*
* @param string $text The visible text to match against.
* @throws UnsupportedOperationException If the SELECT does not support multiple selections
*/
public function deselectByVisibleText($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>`
*
* @param string $text The visible text to match against.
* @throws UnsupportedOperationException If the SELECT does not support multiple selections
*/
public function deselectByVisiblePartialText($text);
}