forked from mirrors/gecko-dev
Bug 1798464 - [marionette] Removed usage of 'isElementEnabled' Selenium atom. r=webdriver-reviewers,Sasha
Differential Revision: https://phabricator.services.mozilla.com/D180144
This commit is contained in:
parent
967c226657
commit
cc3a4fdcef
4 changed files with 13 additions and 12 deletions
|
|
@ -10,7 +10,6 @@ Currently the following atoms are in use:
|
|||
|
||||
- `getElementText`
|
||||
- `isElementDisplayed`
|
||||
- `isElementEnabled`
|
||||
|
||||
To use one of those atoms Javascript modules will have to import
|
||||
[atom.sys.mjs].
|
||||
|
|
@ -56,7 +55,6 @@ commands. Make sure to [install bazelisk] first.
|
|||
```bash
|
||||
bazel build //javascript/atoms/fragments:get-text
|
||||
bazel build //javascript/atoms/fragments:is-displayed
|
||||
bazel build //javascript/atoms/fragments:is-enabled
|
||||
```
|
||||
|
||||
For each of the exported atoms a file can now be found in the folder
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -237,9 +237,7 @@ async function webdriverClickElement(el, a11y) {
|
|||
}
|
||||
|
||||
async function chromeClick(el, a11y) {
|
||||
const win = getWindow(el);
|
||||
|
||||
if (!(await lazy.atom.isElementEnabled(el, win))) {
|
||||
if (!(await lazy.dom.isEnabled(el))) {
|
||||
throw new lazy.error.InvalidElementStateError("Element is not enabled");
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +265,7 @@ async function seleniumClickElement(el, a11y) {
|
|||
throw new lazy.error.ElementNotInteractableError();
|
||||
}
|
||||
|
||||
if (!(await lazy.atom.isElementEnabled(el, win))) {
|
||||
if (!(await lazy.dom.isEnabled(el))) {
|
||||
throw new lazy.error.InvalidElementStateError("Element is not enabled");
|
||||
}
|
||||
|
||||
|
|
@ -776,7 +774,7 @@ interaction.isElementEnabled = async function (el, strict = false) {
|
|||
) {
|
||||
enabled = false;
|
||||
} else {
|
||||
enabled = await lazy.atom.isElementEnabled(el, win);
|
||||
enabled = await lazy.dom.isEnabled(el);
|
||||
}
|
||||
|
||||
let a11y = lazy.accessibility.get(strict);
|
||||
|
|
|
|||
|
|
@ -1054,6 +1054,16 @@ dom.isElement = function (obj) {
|
|||
return dom.isDOMElement(obj) || dom.isXULElement(obj);
|
||||
};
|
||||
|
||||
dom.isEnabled = function (el) {
|
||||
let enabled = false;
|
||||
|
||||
if (el.ownerDocument.contentType !== "text/xml") {
|
||||
enabled = !dom.isDisabled(el);
|
||||
}
|
||||
|
||||
return enabled;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the shadow root of an element.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue