|
20 | 20 | from typing import Optional |
21 | 21 | from typing import Sequence |
22 | 22 |
|
| 23 | +SUPPORT_MSG = "For documentation on this error, please visit:" |
| 24 | +ERROR_URL = "https://www.selenium.dev/documentation/webdriver/troubleshooting/errors" |
| 25 | + |
23 | 26 |
|
24 | 27 | class WebDriverException(Exception): |
25 | 28 | """Base webdriver exception.""" |
@@ -70,6 +73,13 @@ class NoSuchElementException(WebDriverException): |
70 | 73 | for how to write a wait wrapper to wait for an element to appear. |
71 | 74 | """ |
72 | 75 |
|
| 76 | + def __init__( |
| 77 | + self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None |
| 78 | + ) -> None: |
| 79 | + with_support = f"{msg}; {SUPPORT_MSG} {ERROR_URL}#no-such-element-exception" |
| 80 | + |
| 81 | + super().__init__(with_support, screen, stacktrace) |
| 82 | + |
73 | 83 |
|
74 | 84 | class NoSuchAttributeException(WebDriverException): |
75 | 85 | """Thrown when the attribute of element could not be found. |
@@ -102,6 +112,13 @@ class StaleElementReferenceException(WebDriverException): |
102 | 112 | * Element may have been inside an iframe or another context which was refreshed. |
103 | 113 | """ |
104 | 114 |
|
| 115 | + def __init__( |
| 116 | + self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None |
| 117 | + ) -> None: |
| 118 | + with_support = f"{msg}; {SUPPORT_MSG} {ERROR_URL}#stale-element-reference-exception" |
| 119 | + |
| 120 | + super().__init__(with_support, screen, stacktrace) |
| 121 | + |
105 | 122 |
|
106 | 123 | class InvalidElementStateException(WebDriverException): |
107 | 124 | """Thrown when a command could not be completed because the element is in |
@@ -194,6 +211,13 @@ class InvalidSelectorException(WebDriverException): |
194 | 211 | "count(//input)"). |
195 | 212 | """ |
196 | 213 |
|
| 214 | + def __init__( |
| 215 | + self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None |
| 216 | + ) -> None: |
| 217 | + with_support = f"{msg}; {SUPPORT_MSG} {ERROR_URL}#invalid-selector-exception" |
| 218 | + |
| 219 | + super().__init__(with_support, screen, stacktrace) |
| 220 | + |
197 | 221 |
|
198 | 222 | class ImeNotAvailableException(WebDriverException): |
199 | 223 | """Thrown when IME support is not available. |
@@ -253,5 +277,12 @@ class UnknownMethodException(WebDriverException): |
253 | 277 | for that URL.""" |
254 | 278 |
|
255 | 279 |
|
256 | | -class SeleniumManagerException(WebDriverException): |
257 | | - """Raised when an issue interacting with selenium manager occurs.""" |
| 280 | +class NoSuchDriverException(WebDriverException): |
| 281 | + """Raised when driver is not specified and cannot be located.""" |
| 282 | + |
| 283 | + def __init__( |
| 284 | + self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None |
| 285 | + ) -> None: |
| 286 | + with_support = f"{msg}; {SUPPORT_MSG} {ERROR_URL}/driver_location" |
| 287 | + |
| 288 | + super().__init__(with_support, screen, stacktrace) |
0 commit comments