Skip to content

Commit 45bb38a

Browse files
authored
[java] remove references to invalid errors (#10209)
1 parent b3f9d37 commit 45bb38a

7 files changed

Lines changed: 5 additions & 127 deletions

File tree

java/src/org/openqa/selenium/ElementNotSelectableException.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

java/src/org/openqa/selenium/ElementNotVisibleException.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

java/src/org/openqa/selenium/interactions/Coordinates.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public interface Coordinates {
3131
* before calculating its coordinates.
3232
*
3333
* @return coordinates on the element relative to the top-left corner of the monitor (screen).
34-
* @throws org.openqa.selenium.ElementNotVisibleException if the element can't be scrolled into view.
34+
* @throws org.openqa.selenium.ElementNotInteractableException if the element can't be scrolled into view.
3535
*/
3636
Point onScreen();
3737

@@ -41,7 +41,7 @@ public interface Coordinates {
4141
* scrolls the page and/or frames to make element visible in viewport before calculating its coordinates.
4242
*
4343
* @return coordinates on the element relative to the top-left corner of the browser window's viewport.
44-
* @throws org.openqa.selenium.ElementNotVisibleException if the element can't be scrolled into view.
44+
* @throws org.openqa.selenium.ElementNotInteractableException if the element can't be scrolled into view.
4545
*/
4646
Point inViewPort();
4747

java/src/org/openqa/selenium/interactions/InvalidCoordinatesException.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

java/src/org/openqa/selenium/remote/ErrorCodec.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
import org.openqa.selenium.ElementClickInterceptedException;
2525
import org.openqa.selenium.ElementNotInteractableException;
26-
import org.openqa.selenium.ElementNotSelectableException;
27-
import org.openqa.selenium.ElementNotVisibleException;
2826
import org.openqa.selenium.InvalidArgumentException;
2927
import org.openqa.selenium.InvalidCookieDomainException;
3028
import org.openqa.selenium.InvalidElementStateException;
@@ -44,7 +42,6 @@
4442
import org.openqa.selenium.UnhandledAlertException;
4543
import org.openqa.selenium.UnsupportedCommandException;
4644
import org.openqa.selenium.WebDriverException;
47-
import org.openqa.selenium.interactions.InvalidCoordinatesException;
4845
import org.openqa.selenium.interactions.MoveTargetOutOfBoundsException;
4946
import org.openqa.selenium.internal.Require;
5047

@@ -62,12 +59,9 @@ public class ErrorCodec {
6259
private static final Set<W3CError> ERRORS = ImmutableSet.<W3CError>builder()
6360
.add(new W3CError("script timeout", ScriptTimeoutException.class, 500))
6461
.add(new W3CError("element click intercepted", ElementClickInterceptedException.class, 400))
65-
.add(new W3CError("element not selectable", ElementNotSelectableException.class, 400))
6662
.add(new W3CError("element not interactable", ElementNotInteractableException.class, 400))
67-
.add(new W3CError("element not visible", ElementNotVisibleException.class, 400))
6863
.add(new W3CError("invalid argument", InvalidArgumentException.class, 400))
6964
.add(new W3CError("invalid cookie domain", InvalidCookieDomainException.class, 400))
70-
.add(new W3CError("invalid element coordinates", InvalidCoordinatesException.class, 400))
7165
.add(new W3CError("invalid element state", InvalidElementStateException.class, 400))
7266
.add(new W3CError("invalid selector", InvalidSelectorException.class, 400))
7367
.add(new W3CError("invalid session id", NoSuchSessionException.class, 404))

java/src/org/openqa/selenium/remote/ErrorCodes.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import com.google.common.collect.Iterables;
2222
import org.openqa.selenium.ElementClickInterceptedException;
2323
import org.openqa.selenium.ElementNotInteractableException;
24-
import org.openqa.selenium.ElementNotSelectableException;
25-
import org.openqa.selenium.ElementNotVisibleException;
2624
import org.openqa.selenium.ImeActivationFailedException;
2725
import org.openqa.selenium.ImeNotAvailableException;
2826
import org.openqa.selenium.InvalidArgumentException;
@@ -45,7 +43,6 @@
4543
import org.openqa.selenium.UnhandledAlertException;
4644
import org.openqa.selenium.UnsupportedCommandException;
4745
import org.openqa.selenium.WebDriverException;
48-
import org.openqa.selenium.interactions.InvalidCoordinatesException;
4946
import org.openqa.selenium.interactions.MoveTargetOutOfBoundsException;
5047

5148
import java.util.Comparator;
@@ -72,10 +69,8 @@ public class ErrorCodes {
7269
public static final int NO_SUCH_FRAME = 8;
7370
public static final int UNKNOWN_COMMAND = 9;
7471
public static final int STALE_ELEMENT_REFERENCE = 10;
75-
public static final int ELEMENT_NOT_VISIBLE = 11;
7672
public static final int INVALID_ELEMENT_STATE = 12;
7773
public static final int UNHANDLED_ERROR = 13;
78-
public static final int ELEMENT_NOT_SELECTABLE = 15;
7974
public static final int JAVASCRIPT_ERROR = 17;
8075
public static final int XPATH_LOOKUP_ERROR = 19;
8176
public static final int TIMEOUT = 21;
@@ -85,7 +80,6 @@ public class ErrorCodes {
8580
public static final int UNEXPECTED_ALERT_PRESENT = 26;
8681
public static final int NO_ALERT_PRESENT = 27;
8782
public static final int ASYNC_SCRIPT_TIMEOUT = 28;
88-
public static final int INVALID_ELEMENT_COORDINATES = 29;
8983
public static final int IME_NOT_AVAILABLE = 30;
9084
public static final int IME_ENGINE_ACTIVATION_FAILED = 31;
9185
public static final int INVALID_SELECTOR_ERROR = 32;
@@ -226,14 +220,11 @@ public boolean isMappableError(Throwable rootCause) {
226220
private static final ImmutableSet<KnownError> KNOWN_ERRORS = ImmutableSet.<KnownError>builder()
227221
.add(new KnownError(ASYNC_SCRIPT_TIMEOUT, "script timeout", 500, ScriptTimeoutException.class, true, true))
228222
.add(new KnownError(ELEMENT_CLICK_INTERCEPTED, "element click intercepted", 400, ElementClickInterceptedException.class, true, true))
229-
.add(new KnownError(ELEMENT_NOT_SELECTABLE, "element not selectable", 400, ElementNotSelectableException.class, true, true))
230223
.add(new KnownError(ELEMENT_NOT_INTERACTABLE, "element not interactable", 400, ElementNotInteractableException.class, true, true))
231-
.add(new KnownError(ELEMENT_NOT_VISIBLE, "element not visible", 400, ElementNotVisibleException.class, true, true))
232224
.add(new KnownError(IME_ENGINE_ACTIVATION_FAILED, "unsupported operation", 500, ImeActivationFailedException.class, true, false))
233225
.add(new KnownError(IME_NOT_AVAILABLE, "unsupported operation", 500, ImeNotAvailableException.class, true, false))
234226
.add(new KnownError(INVALID_ARGUMENT, "invalid argument", 400, InvalidArgumentException.class, true, true))
235227
.add(new KnownError(INVALID_COOKIE_DOMAIN, "invalid cookie domain", 400, InvalidCookieDomainException.class, true, true))
236-
.add(new KnownError(INVALID_ELEMENT_COORDINATES, "invalid element coordinates", 400, InvalidCoordinatesException.class, true, true))
237228
.add(new KnownError(INVALID_ELEMENT_STATE, "invalid element state", 400, InvalidElementStateException.class, true, true))
238229
.add(new KnownError(INVALID_SELECTOR_ERROR, "invalid selector", 400, InvalidSelectorException.class, true, true))
239230
.add(new KnownError(INVALID_XPATH_SELECTOR, "invalid selector", 400, InvalidSelectorException.class, false, false))

java/test/org/openqa/selenium/remote/ErrorHandlerTest.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,10 @@
1717

1818
package org.openqa.selenium.remote;
1919

20-
import static org.assertj.core.api.Assertions.assertThat;
21-
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
22-
2320
import com.google.common.collect.ImmutableMap;
24-
2521
import org.junit.Before;
2622
import org.junit.Test;
2723
import org.junit.experimental.categories.Category;
28-
import org.openqa.selenium.ElementNotSelectableException;
29-
import org.openqa.selenium.ElementNotVisibleException;
3024
import org.openqa.selenium.ImeActivationFailedException;
3125
import org.openqa.selenium.ImeNotAvailableException;
3226
import org.openqa.selenium.InvalidCookieDomainException;
@@ -46,7 +40,6 @@
4640
import org.openqa.selenium.UnhandledAlertException;
4741
import org.openqa.selenium.UnsupportedCommandException;
4842
import org.openqa.selenium.WebDriverException;
49-
import org.openqa.selenium.interactions.InvalidCoordinatesException;
5043
import org.openqa.selenium.interactions.MoveTargetOutOfBoundsException;
5144
import org.openqa.selenium.json.Json;
5245
import org.openqa.selenium.testing.UnitTests;
@@ -55,6 +48,9 @@
5548
import java.util.HashMap;
5649
import java.util.Map;
5750

51+
import static org.assertj.core.api.Assertions.assertThat;
52+
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
53+
5854
@Category(UnitTests.class)
5955
public class ErrorHandlerTest {
6056
private ErrorHandler handler;
@@ -82,14 +78,10 @@ public void testThrowsCorrectExceptionTypes() {
8278
ErrorCodes.METHOD_NOT_ALLOWED, UnsupportedCommandException.class);
8379
assertThrowsCorrectExceptionType(
8480
ErrorCodes.STALE_ELEMENT_REFERENCE, StaleElementReferenceException.class);
85-
assertThrowsCorrectExceptionType(
86-
ErrorCodes.ELEMENT_NOT_VISIBLE, ElementNotVisibleException.class);
8781
assertThrowsCorrectExceptionType(
8882
ErrorCodes.INVALID_ELEMENT_STATE, InvalidElementStateException.class);
8983
assertThrowsCorrectExceptionType(
9084
ErrorCodes.XPATH_LOOKUP_ERROR, InvalidSelectorException.class);
91-
assertThrowsCorrectExceptionType(ErrorCodes.INVALID_ELEMENT_COORDINATES,
92-
InvalidCoordinatesException.class);
9385
}
9486

9587
private void assertThrowsCorrectExceptionType(int status, Class<? extends RuntimeException> type) {
@@ -394,10 +386,8 @@ public void testStatusCodesRaisedBackToStatusMatches() {
394386
exceptions.put(ErrorCodes.NO_SUCH_FRAME, NoSuchFrameException.class);
395387
exceptions.put(ErrorCodes.UNKNOWN_COMMAND, UnsupportedCommandException.class);
396388
exceptions.put(ErrorCodes.STALE_ELEMENT_REFERENCE, StaleElementReferenceException.class);
397-
exceptions.put(ErrorCodes.ELEMENT_NOT_VISIBLE, ElementNotVisibleException.class);
398389
exceptions.put(ErrorCodes.INVALID_ELEMENT_STATE, InvalidElementStateException.class);
399390
exceptions.put(ErrorCodes.UNHANDLED_ERROR, WebDriverException.class);
400-
exceptions.put(ErrorCodes.ELEMENT_NOT_SELECTABLE, ElementNotSelectableException.class);
401391
exceptions.put(ErrorCodes.JAVASCRIPT_ERROR, JavascriptException.class);
402392
exceptions.put(ErrorCodes.XPATH_LOOKUP_ERROR, InvalidSelectorException.class);
403393
exceptions.put(ErrorCodes.TIMEOUT, TimeoutException.class);
@@ -407,7 +397,6 @@ public void testStatusCodesRaisedBackToStatusMatches() {
407397
exceptions.put(ErrorCodes.UNEXPECTED_ALERT_PRESENT, UnhandledAlertException.class);
408398
exceptions.put(ErrorCodes.NO_ALERT_PRESENT, NoAlertPresentException.class);
409399
exceptions.put(ErrorCodes.ASYNC_SCRIPT_TIMEOUT, ScriptTimeoutException.class);
410-
exceptions.put(ErrorCodes.INVALID_ELEMENT_COORDINATES, InvalidCoordinatesException.class);
411400
exceptions.put(ErrorCodes.IME_NOT_AVAILABLE, ImeNotAvailableException.class);
412401
exceptions.put(ErrorCodes.IME_ENGINE_ACTIVATION_FAILED, ImeActivationFailedException.class);
413402
exceptions.put(ErrorCodes.INVALID_SELECTOR_ERROR, InvalidSelectorException.class);

0 commit comments

Comments
 (0)