@@ -87,6 +87,7 @@ public List<WebElement> getAllSelectedOptions() {
87
87
/**
88
88
* @return The first selected option in this select tag (or the currently selected option in a
89
89
* normal select)
90
+ * @throws NoSuchElementException If no option is selected
90
91
*/
91
92
public WebElement getFirstSelectedOption () {
92
93
for (WebElement option : getOptions ()) {
@@ -105,6 +106,7 @@ public WebElement getFirstSelectedOption() {
105
106
* <option value="foo">Bar</option>
106
107
*
107
108
* @param text The visible text to match against
109
+ * @throws NoSuchElementException If no matching option elements are found
108
110
*/
109
111
public void selectByVisibleText (String text ) {
110
112
// try to find the option via XPATH ...
@@ -165,6 +167,7 @@ private String getLongestSubstringWithoutSpace(String s) {
165
167
* element, and not merely by counting.
166
168
*
167
169
* @param index The option at this index will be selected
170
+ * @throws NoSuchElementException If no matching option elements are found
168
171
*/
169
172
public void selectByIndex (int index ) {
170
173
String match = String .valueOf (index );
@@ -191,6 +194,7 @@ public void selectByIndex(int index) {
191
194
* <option value="foo">Bar</option>
192
195
*
193
196
* @param value The value to match against
197
+ * @throws NoSuchElementException If no matching option elements are found
194
198
*/
195
199
public void selectByValue (String value ) {
196
200
StringBuilder builder = new StringBuilder (".//option[@value = " );
@@ -237,6 +241,7 @@ public void deselectAll() {
237
241
* <option value="foo">Bar</option>
238
242
*
239
243
* @param value The value to match against
244
+ * @throws NoSuchElementException If no matching option elements are found
240
245
*/
241
246
public void deselectByValue (String value ) {
242
247
StringBuilder builder = new StringBuilder (".//option[@value = " );
@@ -255,6 +260,7 @@ public void deselectByValue(String value) {
255
260
* element, and not merely by counting.
256
261
*
257
262
* @param index The option at this index will be deselected
263
+ * @throws NoSuchElementException If no matching option elements are found
258
264
*/
259
265
public void deselectByIndex (int index ) {
260
266
String match = String .valueOf (index );
@@ -273,6 +279,7 @@ public void deselectByIndex(int index) {
273
279
* <option value="foo">Bar</option>
274
280
*
275
281
* @param text The visible text to match against
282
+ * @throws NoSuchElementException If no matching option elements are found
276
283
*/
277
284
public void deselectByVisibleText (String text ) {
278
285
StringBuilder builder = new StringBuilder (".//option[normalize-space(.) = " );
0 commit comments