0% found this document useful (0 votes)
1 views18 pages

Exceptions

Uploaded by

dipesh.31mehta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views18 pages

Exceptions

Uploaded by

dipesh.31mehta
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JAPNEET SACHDEVA

All Selenium
WebDriver
Exceptions
using JAVA

LINKEDIN: @JAPNEET SACHDEVA

TECHNICAL BLOGS: LINK


InvalidElementStateException
Description: Thrown when an action is
attempted on an element that is not in an
interactable state.
Example: Trying to click a disabled button.

Subclasses of
InvalidElementStateException:

ElementNotInteractableException: Indicates
the element is not interactable (e.g., hidden).

ElementClickInterceptedException: Occurs
when a different element intercepts the click
action.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


WebDriverException
Description: Base class for all WebDriver
exceptions.
Example: Thrown when the driver fails to
execute commands.

ConnectionClosedException
Description: Thrown when the connection to
the browser is unexpectedly closed.
Example: The WebDriver loses connection
during a test

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


BiDiException
Description: Represents errors in Bi-Directional
communication with the browser.
Example: Issues in communication with the
browser’s debug protocols.

ConnectionFailedException
Description: Indicates the failure to establish
a connection.
Example: When the browser fails to start or
connect.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


DetachedShadowRootException
Description: Thrown when trying to interact
with a detached shadow root.
Example: A shadow root element is removed
before interaction.

DevToolsException
Description: Errors related to Chrome
DevTools.
Example: Issues during interaction with
Chrome DevTools features.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


HealthCheckFailedException
Description: Indicates a failure during
WebDriver’s health check.
Example: Health check failure in remote
WebDriver setups.

InsecureCertificateException
Description: Thrown when encountering
insecure certificates.
Example: Accessing a site with an invalid SSL
certificate.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


InvalidArgumentException
Description: Indicates that an argument
passed to a method is invalid.
Example: Passing an incorrect selector or
driver option.

InvalidCookieDomainException
Description: Occurs when setting a cookie for
a different domain.
Example: Attempting to set a cookie from
[Link] on [Link].

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


InvalidSelectorException
Description: Thrown when the selector is
invalid.
Example: Passing an invalid XPath or CSS
selector.

JavascriptException
Description: Indicates an error in executing
JavaScript.
Example: JS error when running a script via
executeScript().

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


JsonException
Description: Thrown when there's an issue in
handling JSON.
Example: Parsing or generating incorrect
JSON data.

MoveTargetOutOfBoundsException
Description: Thrown when attempting to move
to a location outside the viewport.
Example: Trying to drag an element out of the
browser view.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


NoSuchDriverException
Description: Indicates that the WebDriver is
not found or has quit unexpectedly.
Example: Referencing a WebDriver instance
after it’s been closed.

NoSuchSessionException
Description: Occurs when the session is no
longer active.
Example: Accessing a session that was
terminated.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


NotFoundException
Description: Base class for exceptions thrown
when an element or resource is not found.

Subclasses of NotFoundException:

NoAlertPresentException: Thrown when no alert


is present.
NoSuchContextException: Occurs when the
desired context (e.g., mobile) is not found.
NoSuchCookieException: Thrown when the
specified cookie is not found.
NoSuchElementException: Indicates an element
could not be located.
NoSuchFrameException: Occurs when switching
to a frame that is not found.
NoSuchShadowRootException: Thrown when
the shadow root is not available.
NoSuchWindowException: Indicates an attempt
to switch to a non-existent window.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


RequestFailedException
Description: Thrown when a network request
fails.
Example: A failure in network traffic capture
during testing.

ScreenshotException
Description: Thrown when capturing a
screenshot fails.
Example: Issues with browser compatibility or
saving screenshots.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


ScriptTimeoutException
Description: Thrown when a script execution
exceeds the defined timeout.
Example: JavaScript execution taking too
long.

SessionNotCreatedException
Description: Indicates that the session could
not be created.

Subclasses of SessionNotCreatedException:

RetrySessionRequestException: Thrown when


retrying to create a session fails.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


StaleElementReferenceException
Description: Thrown when an element is no
longer attached to the DOM.
Example: Trying to interact with an element
after a page refresh.

TimeoutException
Description: Indicates that a command did
not complete in the expected time.
Example: Waiting too long for an element to
be located.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


UnableToCreateProfileException
Description: Thrown when the browser profile
cannot be created.
Example: Issues with launching a browser
with a specific profile.

UnableToSetCookieException
Description: Occurs when setting a cookie
fails.
Example: Issues with cookie attributes or
browser settings.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


UnexpectedTagNameException
Description: Thrown when an element has an
unexpected tag.
Example: Expecting a select element but
receiving a different tag.

UnhandledAlertException
Description: Thrown when there’s an
unhandled alert blocking the operation.
Example: An alert pops up unexpectedly
during test execution.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


UnknownServerException
Description: Indicates an error from the
WebDriver server.
Example: Issues originating from the
WebDriver server or browser driver.

UnreachableBrowserException
Description: Thrown when the browser cannot
be reached.
Example: Browser crashes or is terminated
unexpectedly

UnsupportedCommandException
Description: Thrown when an unsupported
command is issued.
Example: Trying to use a deprecated or
unsupported feature.

LINKEDIN: @JAPNEET SACHDEVA

Swipe Left to continue


et Sach
Jap ne d

ev
a
Stay Tuned..
check out our social media and visit the
website for the latest information.

Career Guidance: Link


SDET Manager Course: Link

@JAPNEET SACHDEVA

You might also like