Skip to content

Commit

Permalink
message response may cause json loads ValueError when it's not actual…
Browse files Browse the repository at this point in the history
…ly json and just a string (like the message that occurs when firefox driver thinks another element will receive the click)

Fixes #1478
  • Loading branch information
lukeis committed Jan 14, 2016
1 parent 86c963d commit 2641315
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions py/selenium/webdriver/remote/errorhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ def check_response(self, response):
value_json = response.get('value', None)
if value_json and isinstance(value_json, basestring):
import json
value = json.loads(value_json)
status = value['error']
message = value['message']
try:
value = json.loads(value_json)
status = value['error']
message = value['message']
except ValueError:
pass

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

0 comments on commit 2641315

Please sign in to comment.