File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
py/selenium/webdriver/remote Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 2222
2323from websocket import WebSocketApp # type: ignore
2424
25+ from selenium .common import WebDriverException
26+
2527logger = logging .getLogger (__name__ )
2628
2729
@@ -65,7 +67,12 @@ def execute(self, command):
6567 response = self ._messages .pop (current_id )
6668
6769 if "error" in response :
68- raise Exception (response ["error" ])
70+ error = response ["error" ]
71+ if "message" in response :
72+ error_msg = f"{ error } : { response ['message' ]} "
73+ raise WebDriverException (error_msg )
74+ else :
75+ raise WebDriverException (error )
6976 else :
7077 result = response ["result" ]
7178 return self ._deserialize_result (result , command )
@@ -97,7 +104,7 @@ def _serialize_command(self, command):
97104 def _deserialize_result (self , result , command ):
98105 try :
99106 _ = command .send (result )
100- 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!" )
101108 except StopIteration as exit :
102109 return exit .value
103110
You can’t perform that action at this time.
0 commit comments