Skip to content

Commit 1cf9853

Browse files
committed
Documenting exceptions. Fixes issue 8090
1 parent 4c3c150 commit 1cf9853

File tree

1 file changed

+7
-0
lines changed
  • java/client/src/org/openqa/selenium/support/ui

1 file changed

+7
-0
lines changed

java/client/src/org/openqa/selenium/support/ui/Select.java

+7
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public List<WebElement> getAllSelectedOptions() {
8787
/**
8888
* @return The first selected option in this select tag (or the currently selected option in a
8989
* normal select)
90+
* @throws NoSuchElementException If no option is selected
9091
*/
9192
public WebElement getFirstSelectedOption() {
9293
for (WebElement option : getOptions()) {
@@ -105,6 +106,7 @@ public WebElement getFirstSelectedOption() {
105106
* &lt;option value="foo"&gt;Bar&lt;/option&gt;
106107
*
107108
* @param text The visible text to match against
109+
* @throws NoSuchElementException If no matching option elements are found
108110
*/
109111
public void selectByVisibleText(String text) {
110112
// try to find the option via XPATH ...
@@ -165,6 +167,7 @@ private String getLongestSubstringWithoutSpace(String s) {
165167
* element, and not merely by counting.
166168
*
167169
* @param index The option at this index will be selected
170+
* @throws NoSuchElementException If no matching option elements are found
168171
*/
169172
public void selectByIndex(int index) {
170173
String match = String.valueOf(index);
@@ -191,6 +194,7 @@ public void selectByIndex(int index) {
191194
* &lt;option value="foo"&gt;Bar&lt;/option&gt;
192195
*
193196
* @param value The value to match against
197+
* @throws NoSuchElementException If no matching option elements are found
194198
*/
195199
public void selectByValue(String value) {
196200
StringBuilder builder = new StringBuilder(".//option[@value = ");
@@ -237,6 +241,7 @@ public void deselectAll() {
237241
* &lt;option value="foo"&gt;Bar&lt;/option&gt;
238242
*
239243
* @param value The value to match against
244+
* @throws NoSuchElementException If no matching option elements are found
240245
*/
241246
public void deselectByValue(String value) {
242247
StringBuilder builder = new StringBuilder(".//option[@value = ");
@@ -255,6 +260,7 @@ public void deselectByValue(String value) {
255260
* element, and not merely by counting.
256261
*
257262
* @param index The option at this index will be deselected
263+
* @throws NoSuchElementException If no matching option elements are found
258264
*/
259265
public void deselectByIndex(int index) {
260266
String match = String.valueOf(index);
@@ -273,6 +279,7 @@ public void deselectByIndex(int index) {
273279
* &lt;option value="foo"&gt;Bar&lt;/option&gt;
274280
*
275281
* @param text The visible text to match against
282+
* @throws NoSuchElementException If no matching option elements are found
276283
*/
277284
public void deselectByVisibleText(String text) {
278285
StringBuilder builder = new StringBuilder(".//option[normalize-space(.) = ");

0 commit comments

Comments
 (0)