Bug 1277090: Have Marionette return only attributes from getElementAttribute. r?ato draft
authorDavid Burns <dburns@mozilla.com>
Tue, 31 May 2016 23:23:05 +0100
changeset 374367 a5232140bc5ca85a0bb17319d26b18b7f4ebecd1
parent 374366 4a84c4e71f09c49947381b3b9a8551ab6f10c5f8
child 374368 17e71375a643799780b32b51fab4aa210c26bcbc
push id19998
push userdburns@mozilla.com
push dateThu, 02 Jun 2016 08:38:49 +0000
reviewersato
bugs1277090
milestone49.0a1
Bug 1277090: Have Marionette return only attributes from getElementAttribute. r?ato Using the Selenium atom we are conflating properties and attributes which is not thing we really want to be doing. MozReview-Commit-ID: HdZOz1jQrwz
testing/marionette/driver.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1781,17 +1781,26 @@ GeckoDriver.prototype.clickElement = fun
  */
 GeckoDriver.prototype.getElementAttribute = function*(cmd, resp) {
   let {id, name} = cmd.parameters;
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
       let el = this.curBrowser.seenEls.get(id, {frame: win});
-      resp.body.value = atom.getElementAttribute(el, name, this.getCurrentWindow());
+
+      if (element.isBooleanAttribute(el, name)) {
+        if (el.hasAttribute(name)) {
+          resp.body.value = "true";
+        } else {
+          resp.body.value = null;
+        }
+      } else {
+        resp.body.value = el.getAttribute(name);
+      }
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.getElementAttribute(id, name);
       break;
   }
 };