@@ -28,33 +28,33 @@ class WebDriverException(Exception):
28
28
Base webdriver exception.
29
29
"""
30
30
31
- def __init__ (self , msg : Optional [str ] = None , screen : Optional [str ] = None , stacktrace : Optional [Sequence [str ]] = None ) -> None :
31
+ def __init__ (
32
+ self , msg : Optional [str ] = None , screen : Optional [str ] = None , stacktrace : Optional [Sequence [str ]] = None
33
+ ) -> None :
32
34
self .msg = msg
33
35
self .screen = screen
34
36
self .stacktrace = stacktrace
35
37
36
38
def __str__ (self ) -> str :
37
- exception_msg = "Message: %s \n " % self .msg
39
+ exception_msg = f "Message: { self .msg } \n "
38
40
if self .screen :
39
41
exception_msg += "Screenshot: available via screen\n "
40
42
if self .stacktrace :
41
43
stacktrace = "\n " .join (self .stacktrace )
42
- exception_msg += "Stacktrace:\n %s" % stacktrace
44
+ exception_msg += f "Stacktrace:\n { stacktrace } "
43
45
return exception_msg
44
46
45
47
46
48
class InvalidSwitchToTargetException (WebDriverException ):
47
49
"""
48
50
Thrown when frame or window target to be switched doesn't exist.
49
51
"""
50
- pass
51
52
52
53
53
54
class NoSuchFrameException (InvalidSwitchToTargetException ):
54
55
"""
55
56
Thrown when frame target to be switched doesn't exist.
56
57
"""
57
- pass
58
58
59
59
60
60
class NoSuchWindowException (InvalidSwitchToTargetException ):
@@ -67,7 +67,6 @@ class NoSuchWindowException(InvalidSwitchToTargetException):
67
67
print driver.window_handles
68
68
69
69
"""
70
- pass
71
70
72
71
73
72
class NoSuchElementException (WebDriverException ):
@@ -80,7 +79,6 @@ class NoSuchElementException(WebDriverException):
80
79
(webpage is still loading) see selenium.webdriver.support.wait.WebDriverWait()
81
80
for how to write a wait wrapper to wait for an element to appear.
82
81
"""
83
- pass
84
82
85
83
86
84
class NoSuchAttributeException (WebDriverException ):
@@ -91,15 +89,13 @@ class NoSuchAttributeException(WebDriverException):
91
89
testing against. Some browsers may have different property names for the same
92
90
property. (IE8's .innerText vs. Firefox .textContent)
93
91
"""
94
- pass
95
92
96
93
97
94
class NoSuchShadowRootException (WebDriverException ):
98
95
"""
99
96
Thrown when trying to access the shadow root of an element when it does not
100
97
have a shadow root attached.
101
98
"""
102
- pass
103
99
104
100
105
101
class StaleElementReferenceException (WebDriverException ):
@@ -118,7 +114,6 @@ class StaleElementReferenceException(WebDriverException):
118
114
node is rebuilt.
119
115
* Element may have been inside an iframe or another context which was refreshed.
120
116
"""
121
- pass
122
117
123
118
124
119
class InvalidElementStateException (WebDriverException ):
@@ -127,7 +122,6 @@ class InvalidElementStateException(WebDriverException):
127
122
128
123
This can be caused by attempting to clear an element that isn't both editable and resettable.
129
124
"""
130
- pass
131
125
132
126
133
127
class UnexpectedAlertPresentException (WebDriverException ):
@@ -138,7 +132,13 @@ class UnexpectedAlertPresentException(WebDriverException):
138
132
commands.
139
133
"""
140
134
141
- def __init__ (self , msg : Optional [str ] = None , screen : Optional [str ] = None , stacktrace : Optional [Sequence [str ]] = None , alert_text : Optional [str ] = None ) -> None :
135
+ def __init__ (
136
+ self ,
137
+ msg : Optional [str ] = None ,
138
+ screen : Optional [str ] = None ,
139
+ stacktrace : Optional [Sequence [str ]] = None ,
140
+ alert_text : Optional [str ] = None ,
141
+ ) -> None :
142
142
super ().__init__ (msg , screen , stacktrace )
143
143
self .alert_text = alert_text
144
144
@@ -153,7 +153,6 @@ class NoAlertPresentException(WebDriverException):
153
153
This can be caused by calling an operation on the Alert() class when an alert is
154
154
not yet on the screen.
155
155
"""
156
- pass
157
156
158
157
159
158
class ElementNotVisibleException (InvalidElementStateException ):
@@ -164,15 +163,13 @@ class ElementNotVisibleException(InvalidElementStateException):
164
163
Most commonly encountered when trying to click or read text
165
164
of an element that is hidden from view.
166
165
"""
167
- pass
168
166
169
167
170
168
class ElementNotInteractableException (InvalidElementStateException ):
171
169
"""
172
170
Thrown when an element is present in the DOM but interactions
173
171
with that element will hit another element due to paint order
174
172
"""
175
- pass
176
173
177
174
178
175
class ElementNotSelectableException (InvalidElementStateException ):
@@ -181,50 +178,42 @@ class ElementNotSelectableException(InvalidElementStateException):
181
178
182
179
For example, selecting a 'script' element.
183
180
"""
184
- pass
185
181
186
182
187
183
class InvalidCookieDomainException (WebDriverException ):
188
184
"""
189
185
Thrown when attempting to add a cookie under a different domain
190
186
than the current URL.
191
187
"""
192
- pass
193
188
194
189
195
190
class UnableToSetCookieException (WebDriverException ):
196
191
"""
197
192
Thrown when a driver fails to set a cookie.
198
193
"""
199
- pass
200
194
201
195
202
196
class RemoteDriverServerException (WebDriverException ):
203
- """
204
- """
205
- pass
197
+ """Todo: Remove this class? it looks unused."""
206
198
207
199
208
200
class TimeoutException (WebDriverException ):
209
201
"""
210
202
Thrown when a command does not complete in enough time.
211
203
"""
212
- pass
213
204
214
205
215
206
class MoveTargetOutOfBoundsException (WebDriverException ):
216
207
"""
217
208
Thrown when the target provided to the `ActionsChains` move()
218
209
method is invalid, i.e. out of document.
219
210
"""
220
- pass
221
211
222
212
223
213
class UnexpectedTagNameException (WebDriverException ):
224
214
"""
225
215
Thrown when a support class did not get an expected web element.
226
216
"""
227
- pass
228
217
229
218
230
219
class InvalidSelectorException (WebDriverException ):
@@ -235,93 +224,80 @@ class InvalidSelectorException(WebDriverException):
235
224
xpath expression) or the expression does not select WebElements
236
225
(e.g. "count(//input)").
237
226
"""
238
- pass
239
227
240
228
241
229
class ImeNotAvailableException (WebDriverException ):
242
230
"""
243
231
Thrown when IME support is not available. This exception is thrown for every IME-related
244
232
method call if IME support is not available on the machine.
245
233
"""
246
- pass
247
234
248
235
249
236
class ImeActivationFailedException (WebDriverException ):
250
237
"""
251
238
Thrown when activating an IME engine has failed.
252
239
"""
253
- pass
254
240
255
241
256
242
class InvalidArgumentException (WebDriverException ):
257
243
"""
258
244
The arguments passed to a command are either invalid or malformed.
259
245
"""
260
- pass
261
246
262
247
263
248
class JavascriptException (WebDriverException ):
264
249
"""
265
250
An error occurred while executing JavaScript supplied by the user.
266
251
"""
267
- pass
268
252
269
253
270
254
class NoSuchCookieException (WebDriverException ):
271
255
"""
272
256
No cookie matching the given path name was found amongst the associated cookies of the
273
257
current browsing context's active document.
274
258
"""
275
- pass
276
259
277
260
278
261
class ScreenshotException (WebDriverException ):
279
262
"""
280
263
A screen capture was made impossible.
281
264
"""
282
- pass
283
265
284
266
285
267
class ElementClickInterceptedException (WebDriverException ):
286
268
"""
287
269
The Element Click command could not be completed because the element receiving the events
288
270
is obscuring the element that was requested to be clicked.
289
271
"""
290
- pass
291
272
292
273
293
274
class InsecureCertificateException (WebDriverException ):
294
275
"""
295
276
Navigation caused the user agent to hit a certificate warning, which is usually the result
296
277
of an expired or invalid TLS certificate.
297
278
"""
298
- pass
299
279
300
280
301
281
class InvalidCoordinatesException (WebDriverException ):
302
282
"""
303
283
The coordinates provided to an interaction's operation are invalid.
304
284
"""
305
- pass
306
285
307
286
308
287
class InvalidSessionIdException (WebDriverException ):
309
288
"""
310
289
Occurs if the given session id is not in the list of active sessions, meaning the session
311
290
either does not exist or that it's not active.
312
291
"""
313
- pass
314
292
315
293
316
294
class SessionNotCreatedException (WebDriverException ):
317
295
"""
318
296
A new session could not be created.
319
297
"""
320
- pass
321
298
322
299
323
300
class UnknownMethodException (WebDriverException ):
324
301
"""
325
302
The requested command matched a known URL but did not match any methods for that URL.
326
303
"""
327
- pass
0 commit comments