Bug 1434872 - [wdclient] Handle SessionNotCreatedException in session.send_command(). draft
authorHenrik Skupin <mail@hskupin.info>
Fri, 04 May 2018 21:19:35 +0200
changeset 793239 7cff75e9870b31e837f90c8d4ffd22ea94d7f584
parent 793238 76aad17f5b50a1b969eec8cbb5aa9875555640bc
child 793240 4be2960b7f7591df9c541dbd16767c8451745834
push id109323
push userbmo:hskupin@gmail.com
push dateWed, 09 May 2018 19:25:09 +0000
bugs1434872
milestone62.0a1
Bug 1434872 - [wdclient] Handle SessionNotCreatedException in session.send_command(). In case the driver already deleted the session (eg last window closed) make sure to also invalidate the internal session id. MozReview-Commit-ID: EIbrEDk73jN
testing/web-platform/tests/tools/webdriver/webdriver/client.py
--- a/testing/web-platform/tests/tools/webdriver/webdriver/client.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
@@ -430,17 +430,23 @@ class Session(object):
             an error.
         """
         response = self.transport.send(
             method, url, body,
             encoder=protocol.Encoder, decoder=protocol.Decoder,
             session=self)
 
         if response.status != 200:
-            raise error.from_response(response)
+            err = error.from_response(response)
+
+            if isinstance(err, error.SessionNotCreatedException):
+                # The driver could have already been deleted the session.
+                self.session_id = None
+
+            raise err
 
         if "value" in response.body:
             value = response.body["value"]
             """
             Edge does not yet return the w3c session ID.
             We want the tests to run in Edge anyway to help with REC.
             In order to run the tests in Edge, we need to hack around
             bug: