Bug 1274550 - Make get_active_element in Python client backwards compatible; r?automatedtester draft
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 26 May 2016 13:05:27 +0100
changeset 371442 c039130ca365d8d2b4b0a7cb0fc942a6bb63f903
parent 371441 b447cff08ee2bfcc7fcc7c9b48376311a63549c8
child 521995 101ae239bca770a23bd133e0acc3127083be62f8
push id19329
push userbmo:ato@mozilla.com
push dateThu, 26 May 2016 16:33:07 +0000
reviewersautomatedtester
bugs1274550
milestone49.0a1
Bug 1274550 - Make get_active_element in Python client backwards compatible; r?automatedtester MozReview-Commit-ID: 2SGSpW78stG
testing/marionette/client/marionette_driver/marionette.py
--- 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".