Bug 1274550 - Make get_active_element in Python client backwards compatible; r=automatedtester
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 26 May 2016 13:05:27 +0100
changeset 299215 dd558e06d595766b9e273482af05baee33dcbdc6
parent 299214 cdac1e9c5416558e08f32e507f61ac6a33c1036f
child 299216 2555e6b571f37b4a2315339858af46ac0c0713a2
push id30291
push userryanvm@gmail.com
push dateFri, 27 May 2016 01:45:30 +0000
treeherdermozilla-central@4d63dde701b4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1274550
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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".