Skip to content

Commit 8f65de2

Browse files
authored
[py] add doc support for few exceptions (#15913)
1 parent c136253 commit 8f65de2

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

py/selenium/common/exceptions.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,25 @@ class ElementNotVisibleException(InvalidElementStateException):
165165
element that is hidden from view.
166166
"""
167167

168+
def __init__(
169+
self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None
170+
) -> None:
171+
with_support = f"{msg}; {SUPPORT_MSG} {ERROR_URL}#elementnotvisibleexception"
172+
173+
super().__init__(with_support, screen, stacktrace)
174+
168175

169176
class ElementNotInteractableException(InvalidElementStateException):
170177
"""Thrown when an element is present in the DOM but interactions with that
171178
element will hit another element due to paint order."""
172179

180+
def __init__(
181+
self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None
182+
) -> None:
183+
with_support = f"{msg}; {SUPPORT_MSG} {ERROR_URL}#elementnotinteractableexception"
184+
185+
super().__init__(with_support, screen, stacktrace)
186+
173187

174188
class ElementNotSelectableException(InvalidElementStateException):
175189
"""Thrown when trying to select an unselectable element.
@@ -252,6 +266,13 @@ class ElementClickInterceptedException(WebDriverException):
252266
receiving the events is obscuring the element that was requested to be
253267
clicked."""
254268

269+
def __init__(
270+
self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None
271+
) -> None:
272+
with_support = f"{msg}; {SUPPORT_MSG} {ERROR_URL}#elementclickinterceptedexception"
273+
274+
super().__init__(with_support, screen, stacktrace)
275+
255276

256277
class InsecureCertificateException(WebDriverException):
257278
"""Navigation caused the user agent to hit a certificate warning, which is
@@ -266,10 +287,24 @@ class InvalidSessionIdException(WebDriverException):
266287
"""Occurs if the given session id is not in the list of active sessions,
267288
meaning the session either does not exist or that it's not active."""
268289

290+
def __init__(
291+
self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None
292+
) -> None:
293+
with_support = f"{msg}; {SUPPORT_MSG} {ERROR_URL}#invalidsessionidexception"
294+
295+
super().__init__(with_support, screen, stacktrace)
296+
269297

270298
class SessionNotCreatedException(WebDriverException):
271299
"""A new session could not be created."""
272300

301+
def __init__(
302+
self, msg: Optional[str] = None, screen: Optional[str] = None, stacktrace: Optional[Sequence[str]] = None
303+
) -> None:
304+
with_support = f"{msg}; {SUPPORT_MSG} {ERROR_URL}#sessionnotcreatedexception"
305+
306+
super().__init__(with_support, screen, stacktrace)
307+
273308

274309
class UnknownMethodException(WebDriverException):
275310
"""The requested command matched a known URL but did not match any methods

0 commit comments

Comments
 (0)