Bug 1274550 - Make get_active_element in Python client backwards compatible; r?automatedtester
MozReview-Commit-ID: 2SGSpW78stG
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1671,20 +1671,21 @@ class Marionette(object):
with the specified id.
"""
body = {"value": target, "using": method}
if id:
body["element"] = id
return self._send_message(
"findElements", body, key="value" if self.protocol == 1 else None)
-
def get_active_element(self):
- el = self._send_message("getActiveElement", key="value")
- return HTMLElement(self, el)
+ el_or_ref = self._send_message("getActiveElement", key="value")
+ if self.protocol < 3:
+ return HTMLElement(self, el_or_ref)
+ return el_or_ref
def log(self, msg, level="INFO"):
"""Stores a timestamped log message in the Marionette server
for later retrieval.
:param msg: String with message to log.
:param level: String with log level (e.g. "INFO" or "DEBUG").
Defaults to "INFO".