Skip to content

Commit 90cfe35

Browse files
committed
[js] Add a new ElementNotInteractableError
The spec was updated to replace the "element not visible" error with "element not interactable", so do the same in the JS client. The old ElementNotVisibleError will be deleted after one release. #4491
1 parent 7e8fc51 commit 90cfe35

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

javascript/node/selenium-webdriver/CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## v.next
2+
3+
### Changes for W3C WebDriver Spec Compliance
4+
5+
* Deprecated `error.ElementNotVisibleError` in favor of the more generic
6+
`error.ElementNotInteractableError`.
7+
8+
19
## v3.5.0
210

311
### Notice

javascript/node/selenium-webdriver/lib/error.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,27 @@ class ElementNotSelectableError extends WebDriverError {
5151
}
5252

5353

54+
/**
55+
* Indicates a command could not be completed because the target element is
56+
* not pointer or keyboard interactable. This will often occur if an element
57+
* is present in the DOM, but not rendered (i.e. its CSS style has
58+
* "display: none").
59+
*/
60+
class ElementNotInteractableError extends WebDriverError {
61+
/** @param {string=} opt_error the error message, if any. */
62+
constructor(opt_error) {
63+
super(opt_error);
64+
}
65+
}
66+
67+
5468
/**
5569
* An element command could not be completed because the element is not visible
5670
* on the page.
71+
*
72+
* @deprecated Use {@link ElementNotInteractable} instead.
5773
*/
58-
class ElementNotVisibleError extends WebDriverError {
74+
class ElementNotVisibleError extends ElementNotInteractableError {
5975
/** @param {string=} opt_error the error message, if any. */
6076
constructor(opt_error) {
6177
super(opt_error);
@@ -400,6 +416,7 @@ const LEGACY_ERROR_CODE_TO_TYPE = new Map([
400416

401417
const ERROR_CODE_TO_TYPE = new Map([
402418
['unknown error', WebDriverError],
419+
['element not interactable', ElementNotInteractableError],
403420
['element not selectable', ElementNotSelectableError],
404421
['element not visible', ElementNotVisibleError],
405422
['invalid argument', InvalidArgumentError],
@@ -547,6 +564,7 @@ module.exports = {
547564
ErrorCode: ErrorCode,
548565

549566
WebDriverError: WebDriverError,
567+
ElementNotInteractableError: ElementNotInteractableError,
550568
ElementNotSelectableError: ElementNotSelectableError,
551569
ElementNotVisibleError: ElementNotVisibleError,
552570
InvalidArgumentError: InvalidArgumentError,

javascript/node/selenium-webdriver/test/lib/error_test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ describe('error', function() {
3838
});
3939

4040
test('unknown error', error.WebDriverError);
41+
test('element not interactable', error.ElementNotInteractableError);
4142
test('element not selectable', error.ElementNotSelectableError);
4243
test('element not visible', error.ElementNotVisibleError);
4344
test('invalid argument', error.InvalidArgumentError);

0 commit comments

Comments
 (0)