Bug 1277090 - getElementAttribute() has to only return attributes.
Formerly getElementAttribute() has returned a mix of attributes and
properties. Since getElementProperty() has been added, there is no
need anymore for getElementAttribute() to return conflated data.
MozReview-Commit-ID: 29saWd9PsOX
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -64,18 +64,24 @@ class HTMLElement(object):
"""
body = {"id": self.id, "name": name}
return self.marionette._send_message("getElementAttribute", body, key="value")
def get_property(self, name):
"""Returns the requested property, or None if the property is
not set.
"""
- body = {"id": self.id, "name": name}
- return self.marionette._send_message("getElementProperty", body, key="value")
+ try:
+ body = {"id": self.id, "name": name}
+ return self.marionette._send_message("getElementProperty", body, key="value")
+ except errors.UnknownCommandException:
+ # Keep backward compatibility for code which uses get_attribute() to
+ # also retrieve element properties.
+ # Remove when Firefox 55 is stable.
+ return self.get_attribute(name)
def click(self):
self.marionette._send_message("clickElement", {"id": self.id})
def tap(self, x=None, y=None):
"""Simulates a set of tap events on the element.
:param x: X coordinate of tap event. If not given, default to
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1837,17 +1837,18 @@ 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());
+
+ resp.body.value = el.getAttribute(name);
break;
case Context.CONTENT:
resp.body.value = yield this.listener.getElementAttribute(id, name);
break;
}
};