Bug 1274550 - Make get_active_element in Python client backwards compatible; r=automatedtester a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 26 May 2016 13:05:27 +0100
changeset 333268 240b7e66dfef9a2dccd39bb32846ab41ece57fb8
parent 333267 46a8549641ff87ed60e5a993cfe989fa49898ee3
child 333269 ce27e31f37397a038bd714dba0b09eddf58ef08c
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester, test-only
bugs1274550
milestone48.0a2
Bug 1274550 - Make get_active_element in Python client backwards compatible; r=automatedtester a=test-only 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
@@ -1779,20 +1779,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".