Skip to content

Commit 0bc7e5e

Browse files
committed
raise WebDriverException
1 parent 6b89375 commit 0bc7e5e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

py/selenium/webdriver/remote/websocket_connection.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
from websocket import WebSocketApp # type: ignore
2424

25+
from selenium.common import WebDriverException
26+
2527
logger = logging.getLogger(__name__)
2628

2729

@@ -68,9 +70,9 @@ def execute(self, command):
6870
error = response["error"]
6971
if "message" in response:
7072
error_msg = f"{error}: {response['message']}"
71-
raise Exception(error_msg)
73+
raise WebDriverException(error_msg)
7274
else:
73-
raise Exception(error)
75+
raise WebDriverException(error)
7476
else:
7577
result = response["result"]
7678
return self._deserialize_result(result, command)
@@ -102,7 +104,7 @@ def _serialize_command(self, command):
102104
def _deserialize_result(self, result, command):
103105
try:
104106
_ = command.send(result)
105-
raise Exception("The command's generator function did not exit when expected!")
107+
raise WebDriverException("The command's generator function did not exit when expected!")
106108
except StopIteration as exit:
107109
return exit.value
108110

0 commit comments

Comments
 (0)