Skip to content

Commit

Permalink
Allow error handling to handle both current errors and w3c errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomatedTester committed Jul 16, 2015
1 parent 4efa15d commit b0807bc
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions py/selenium/webdriver/remote/errorhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,22 @@ def check_response(self, response):
:Raises: If the response contains an error message.
"""
status = response['status']
if status == ErrorCode.SUCCESS:
status = response.get('status', None)
if status is None or status == ErrorCode.SUCCESS:
return

value = None
message = response.get("message", "")
screen = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
value = json.loads(value_json)
status = value['status']
message = value['message']

exception_class = ErrorInResponseException
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
Expand Down

0 comments on commit b0807bc

Please sign in to comment.