Bug 1328298 - Rename webdriver.handles to window_handle; r?automatedtester draft
authorAndreas Tolfsen <ato@mozilla.com>
Tue, 03 Jan 2017 16:35:41 +0000
changeset 486216 e794a477f2c6ad8d849649a65fc3485875e2c9ce
parent 486215 d3ceca0c7bbf61e1a1e677513cd464cb9cb0868e
child 486217 b94285a9521ad5f95330000ae4330c08f7165ab5
push id45918
push userbmo:ato@mozilla.com
push dateFri, 17 Feb 2017 16:52:20 +0000
reviewersautomatedtester
bugs1328298
milestone54.0a1
Bug 1328298 - Rename webdriver.handles to window_handle; r?automatedtester MozReview-Commit-ID: 2HV3btJYI4S
testing/web-platform/harness/wptrunner/executors/pytestrunner/fixtures.py
testing/web-platform/tests/tools/webdriver/webdriver/client.py
--- a/testing/web-platform/harness/wptrunner/executors/pytestrunner/fixtures.py
+++ b/testing/web-platform/harness/wptrunner/executors/pytestrunner/fixtures.py
@@ -102,17 +102,17 @@ class Session(object):
         self.client.switch_frame(None)
 
     def windows(self, exclude=None):
         """Set of window handles, filtered by an `exclude` list if
         provided.
         """
         if exclude is None:
             exclude = []
-        wins = [w for w in self.client.handles if w not in exclude]
+        wins = [w for w in self.client.window_handles if w not in exclude]
         return set(wins)
 
 
 class HTTPRequest(object):
     def __init__(self, host, port):
         self.host = host
         self.port = port
 
--- a/testing/web-platform/tests/tools/webdriver/webdriver/client.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
@@ -371,18 +371,17 @@ class Session(object):
     @property
     @command
     def window_handle(self):
         return self.send_command("GET", "window_handle", key="value")
 
     @window_handle.setter
     @command
     def window_handle(self, handle):
-        body = {"handle": handle}
-        return self.send_command("POST", "window", body=body)
+        return self.send_command("POST", "window", body={"handle": handle})
 
     def switch_frame(self, frame):
         if frame == "parent":
             url = "frame/parent"
             body = None
         else:
             url = "frame"
             if isinstance(frame, Element):
@@ -393,18 +392,19 @@ class Session(object):
         return self.send_command("POST", url, body)
 
     @command
     def close(self):
         return self.send_command("DELETE", "window_handle")
 
     @property
     @command
-    def handles(self):
-        return self.send_command("GET", "window_handles", key="value")
+    def window_handles(self):
+        handles = self.send_command("GET", "window_handles", key="value")
+        return set(handles)
 
     @property
     @command
     def active_element(self):
         data = self.send_command("GET", "element/active", key="value")
         if data is not None:
             return self._element(data)