Bug 1321516 - Remove old Marionette click implementation
This change removes the old element click implementation used for in
Selenium conformance mode when the specificationLevel capability was 0.
This effectively makes the WebDriver Element Click command implementation
the default.
MozReview-Commit-ID: DWDd5zEzZe5
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2216,17 +2216,17 @@ GeckoDriver.prototype.clickElement = asy
const win = assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
let id = cmd.parameters.id;
switch (this.context) {
case Context.CHROME:
let el = this.curBrowser.seenEls.get(id, {frame: win});
- await interaction.clickElement(el, this.a11yChecks);
+ await interaction.clickElement(el, {strict: this.a11yChecks});
break;
case Context.CONTENT:
// We need to protect against the click causing an OOP frame
// to close. This fires the mozbrowserclose event when it closes
// so we need to listen for it and then just send an error back.
// The person making the call should be aware something is not right
// and handle accordingly.
--- a/testing/marionette/interaction.js
+++ b/testing/marionette/interaction.js
@@ -107,55 +107,45 @@ const INPUT_TYPES_NO_EVENT = new Set([
this.interaction = {};
/**
* Interact with an element by clicking it.
*
* The element is scrolled into view before visibility- or interactability
* checks are performed.
*
- * Selenium-style visibility checks will be performed
- * if <var>specCompat</var> is false (default). Otherwise
- * pointer-interactability checks will be performed. If either of these
- * fail an {@link ElementNotInteractableError} is thrown.
- *
* If <var>strict</var> is enabled (defaults to disabled), further
* accessibility checks will be performed, and these may result in an
* {@link ElementNotAccessibleError} being returned.
*
* When <var>el</var> is not enabled, an {@link InvalidElementStateError}
* is returned.
*
* @param {(DOMElement|XULElement)} el
* Element to click.
* @param {boolean=} [strict=false] strict
* Enforce strict accessibility tests.
- * @param {boolean=} [specCompat=false] specCompat
- * Use WebDriver specification compatible interactability definition.
*
* @throws {ElementNotInteractableError}
* If either Selenium-style visibility check or
* pointer-interactability check fails.
* @throws {ElementClickInterceptedError}
* If <var>el</var> is obscured by another element and a click would
* not hit, in <var>specCompat</var> mode.
* @throws {ElementNotAccessibleError}
* If <var>strict</var> is true and element is not accessible.
* @throws {InvalidElementStateError}
* If <var>el</var> is not enabled.
*/
-interaction.clickElement = async function(
- el, strict = false, specCompat = false) {
+interaction.clickElement = async function(el, {strict = false} = {}) {
const a11y = accessibility.get(strict);
if (element.isXULElement(el)) {
await chromeClick(el, a11y);
- } else if (specCompat) {
+ } else {
await webdriverClickElement(el, a11y);
- } else {
- await seleniumClickElement(el, a11y);
}
};
async function webdriverClickElement(el, a11y) {
const win = getWindow(el);
// step 3
if (el.localName == "input" && el.type == "file") {
@@ -221,47 +211,16 @@ async function chromeClick(el, a11y) {
if (el.localName == "option") {
interaction.selectOption(el);
} else {
el.click();
}
}
-async function seleniumClickElement(el, a11y) {
- let win = getWindow(el);
-
- let visibilityCheckEl = el;
- if (el.localName == "option") {
- visibilityCheckEl = element.getContainer(el);
- }
-
- if (!element.isVisible(visibilityCheckEl)) {
- throw new ElementNotInteractableError();
- }
-
- if (!atom.isElementEnabled(el)) {
- throw new InvalidElementStateError("Element is not enabled");
- }
-
- let acc = await a11y.getAccessible(el, true);
- a11y.assertVisible(acc, el, true);
- a11y.assertEnabled(acc, el, true);
- a11y.assertActionable(acc, el);
-
- if (el.localName == "option") {
- interaction.selectOption(el);
- } else {
- let rects = el.getClientRects();
- let centre = element.getInViewCentrePoint(rects[0], win);
- let opts = {};
- event.synthesizeMouseAtPoint(centre.x, centre.y, opts, win);
- }
-}
-
/**
* Select <tt><option></tt> element in a <tt><select></tt>
* list.
*
* Because the dropdown list of select elements are implemented using
* native widget technology, our trusted synthesised events are not able
* to reach them. Dropdowns are instead handled mimicking DOM events,
* which for obvious reasons is not ideal, but at the current point in
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -1361,19 +1361,17 @@ function clickElement(msg) {
if (target === "_blank") {
loadEventExpected = false;
}
loadListener.navigate(() => {
return interaction.clickElement(
seenEls.get(id, curContainer),
- capabilities.get("moz:accessibilityChecks"),
- capabilities.get("specificationLevel") >= 1
- );
+ {strict: capabilities.get("moz:accessibilityChecks")});
}, commandID, pageTimeout, loadEventExpected, true);
} catch (e) {
sendError(e, commandID);
}
}
function getElementAttribute(id, name) {