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 22
22
23
23
from websocket import WebSocketApp # type: ignore
24
24
25
+ from selenium .common import WebDriverException
26
+
25
27
logger = logging .getLogger (__name__ )
26
28
27
29
@@ -65,7 +67,12 @@ def execute(self, command):
65
67
response = self ._messages .pop (current_id )
66
68
67
69
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 )
69
76
else :
70
77
result = response ["result" ]
71
78
return self ._deserialize_result (result , command )
@@ -97,7 +104,7 @@ def _serialize_command(self, command):
97
104
def _deserialize_result (self , result , command ):
98
105
try :
99
106
_ = 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!" )
101
108
except StopIteration as exit :
102
109
return exit .value
103
110
You can’t perform that action at this time.
0 commit comments