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.
The same cheatsheet as table form.
|ElementNotVisibleException||Element is present but not visible and cannot be interacted with|
|NoSuchElementException||Element not present in DOM. Thrown by findElement(By by) & findElements(By by)|
|StaleElementReferenceException||The reference to the element is now stale. ie it no longer appears on the DOM of the page|
|TimeoutException||Thrown when a command does not complete in enough time.|
|InvalidCoordinatesException||The coordinates provided to an interactions operation are invalid.|
|MoveTargetOutOfBoundsException||The target provided to the actions move() method is invalid – outside of the size of the window|
|NoAlertPresentException||When user tries to access an alert when its not present.|
|InvalidCookieDomainException||Thrown when attempting to add a cookie under a different domain than the current URL.|
|NoSuchFrameException||Thrown by WebDriver.switchTo().frame(int/String) when accessing frame which is not present|
|NoSuchSessionException||Thrown by any command being called after WebDriver.quit().|
|NoSuchWindowException||Thrown by WebDriver.switchTo().window(String) when accessing window which is not present|
|NoSuchContextException||Thrown by ContextAware.context(String) WebDriver.switchTo().context(String name)}.|
|UnableToSetCookieException||Thrown when a driver fails to set a cookie.|
|UnhandledAlertException||Alert is present due to which the operation cannot be performed|
|UnreachableBrowserException||Problem with connection to browser due to closing of browser, invalid remote server address|
|ConnectionClosedException||Exception thrown when the connection to the SafariDriver is lost.|
|UnsupportedCommandException||Used to indicate that a command used by the remote webdriver is unsupported.|