Skip to content

Commit 22a21b4

Browse files
alb-i986ddavison
authored andcommitted
Refactor concrete WebDriverException#getSupportUrl's
Extract urls to constants. Signed-off-by: Daniel Davison <daniel.jj.davison@gmail.com>
1 parent e0e8614 commit 22a21b4

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

java/client/src/org/openqa/selenium/InvalidSelectorException.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
*/
2828
public class InvalidSelectorException extends NoSuchElementException {
2929

30+
private static final String SUPPORT_URL =
31+
BASE_SUPPORT_URL + "invalid_selector_exception.html";
32+
3033
public InvalidSelectorException(String reason) {
3134
super(reason);
3235
}
@@ -37,6 +40,6 @@ public InvalidSelectorException(String reason, Throwable cause) {
3740

3841
@Override
3942
public String getSupportUrl() {
40-
return "http://seleniumhq.org/exceptions/invalid_selector_exception.html";
43+
return SUPPORT_URL;
4144
}
4245
}

java/client/src/org/openqa/selenium/NoSuchElementException.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
*/
2424
public class NoSuchElementException extends NotFoundException {
2525

26+
private static final String SUPPORT_URL =
27+
BASE_SUPPORT_URL + "no_such_element.html";
28+
2629
public NoSuchElementException(String reason) {
2730
super(reason);
2831
}
@@ -33,6 +36,6 @@ public NoSuchElementException(String reason, Throwable cause) {
3336

3437
@Override
3538
public String getSupportUrl() {
36-
return "http://seleniumhq.org/exceptions/no_such_element.html";
39+
return SUPPORT_URL;
3740
}
3841
}

java/client/src/org/openqa/selenium/StaleElementReferenceException.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
* DOM of the page.
2424
*/
2525
public class StaleElementReferenceException extends WebDriverException {
26+
27+
private static final String SUPPORT_URL =
28+
BASE_SUPPORT_URL + "stale_element_reference.html";
29+
2630
public StaleElementReferenceException(String message) {
2731
super(message);
2832
}
@@ -33,6 +37,6 @@ public StaleElementReferenceException(String message, Throwable cause) {
3337

3438
@Override
3539
public String getSupportUrl() {
36-
return "http://seleniumhq.org/exceptions/stale_element_reference.html";
40+
return SUPPORT_URL;
3741
}
3842
}

java/client/src/org/openqa/selenium/WebDriverException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class WebDriverException extends RuntimeException {
2828

2929
public static final String SESSION_ID = "Session ID";
3030
public static final String DRIVER_INFO = "Driver info";
31+
protected static final String BASE_SUPPORT_URL = "http://seleniumhq.org/exceptions/";
3132

3233
private Map<String, String> extraInfo = new HashMap<>();
3334

0 commit comments

Comments
 (0)