Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions py/selenium/webdriver/remote/websocket_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

from websocket import WebSocketApp # type: ignore

from selenium.common import WebDriverException

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -65,7 +67,12 @@ def execute(self, command):
response = self._messages.pop(current_id)

if "error" in response:
raise Exception(response["error"])
error = response["error"]
if "message" in response:
error_msg = f"{error}: {response['message']}"
raise WebDriverException(error_msg)
else:
raise WebDriverException(error)
else:
result = response["result"]
return self._deserialize_result(result, command)
Expand Down Expand Up @@ -97,7 +104,7 @@ def _serialize_command(self, command):
def _deserialize_result(self, result, command):
try:
_ = command.send(result)
raise Exception("The command's generator function did not exit when expected!")
raise WebDriverException("The command's generator function did not exit when expected!")
except StopIteration as exit:
return exit.value

Expand Down
Loading