Selenium WebDriver Exceptions CheatSheet

In a previous post, we have provided a cheat sheet for Selenium WebDriver. In this post, you can see a Selenium WebDriver Exceptions CheatSheet.

Here the common exceptions and covered along with the reasons for them.


WebDriver Exceptions CheatSheet

The same cheatsheet as table form.

ElementNotVisibleExceptionElement is present but not visible and cannot be interacted with
NoSuchElementException Element not present in DOM. Thrown by findElement(By by) & findElements(By by)
StaleElementReferenceExceptionThe reference to the element is now stale. ie it no longer appears on the DOM of the page
TimeoutExceptionThrown when a command does not complete in enough time.
InvalidCoordinatesExceptionThe coordinates provided to an interactions operation are invalid.
MoveTargetOutOfBoundsExceptionThe target provided to the actions move() method is invalid – outside of the size of the window
NoAlertPresentExceptionWhen user tries to access an alert when its not present.
InvalidCookieDomainExceptionThrown when attempting to add a cookie under a different domain than the current URL.
NoSuchFrameExceptionThrown by WebDriver.switchTo().frame(int/String) when accessing frame which is not present
NoSuchSessionExceptionThrown by any command being called after WebDriver.quit().
NoSuchWindowExceptionThrown by WebDriver.switchTo().window(String) when accessing window which is not present
NoSuchContextExceptionThrown by ContextAware.context(String) WebDriver.switchTo().context(String name)}.
UnableToSetCookieExceptionThrown when a driver fails to set a cookie.
UnhandledAlertExceptionAlert is present due to which the operation cannot be performed
UnreachableBrowserExceptionProblem with connection to browser due to closing of browser, invalid remote server address
ConnectionClosedExceptionException thrown when the connection to the SafariDriver is lost.
UnsupportedCommandExceptionUsed to indicate that a command used by the remote webdriver is unsupported.
SEE ALSO:   Guidelines for Page Object Model Frameworks


Download the cheat sheet in PDF form  Download

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *