All Selenium Exceptions

Exception : An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.

Description: When an error occurs within a method, the method creates an object and hands it off to the runtime system. The object, called an exception object, contains information about the error, including its type and the state of the program when the error occurred. Creating an exception object and handing it to the runtime system is called throwing an exception.
After a method throws an exception, the runtime system attempts to find something to handle it. The set of possible "somethings" to handle the exception is the ordered list of methods that had been called to get to the method where the error occurred.

  • java.lang.Object
  •    java.lang.Throwable
  •           java.lang.Exception
  •             java.lang.RuntimeException
  •               org.openqa.selenium.WebDriverException

  1. NoSuchElementException : FindBy method can’t find the element.
  2. NoSuchFrameException:This Exception occurs when the driver is switching to an invalid frame, which is not available.
  3. NoSuchWindowException:This Exception occurs when the driver is switching to an invalid Window, which is not available
  4. NoAlertPresentException:This Exception occurs when the driver is switching to an invalid Alert, which is not available.
  5. StaleElementReferenceException : This tells that element is no longer appearing on the DOM page.
  6. TimeoutException: This tells that the execution is failed because the command did not complete in enough time.
  7. ElementNotVisibleException: Thrown to indicate that although an element is present on the DOM, it is not visible, and so is not able to be interacted withHidden Elements, which has presence in DOM and it, is not visible. Visibility means the height and width should be greater than zero. Hidden Elements are defined in HTML using of type=”hidden”.
  8. ElementNotSelectableException: Thrown to indicate that may be the element is disabled, and so is not able to select.
  9. SessionNotFoundException:This Exception occurs when the driver is performing the action after immediately quitting the browser
  10. WebDriverException:This Exception occurs when the driver is performing the action after immediately closing the browser
  11. InvalidElementState : An element command could not be completed because the element is in an invalid state (e.g. attempting to click a disabled element).
  12. UnknownError : An unknown server-side error occurred while processing the command.
  13. JavaScriptError : An error occurred while executing JavaScript code.
  14. XPathLookupError : An error occurred while searching for an element by XPath.
  15. UnknownCommand : The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource.
  16. firefox.NotConnectedException: Occurs when Firefox browser  upgraded with new version. 
  17. InvalidCoordinatesException-Indicates that the coordinates provided to an interactions operation are invalid
  18. UnhandledAlertException-When User tries to access an alert when it is not present
  19. MoveTargetOutOfBoundsException-Indicates that the target provided to the actions move() method is invalid - outside of the size of the window.
  20. UnsupportedCommandException-Used to indicate that a command used by the remote webdriver is unsupported.
  21. UnreachableBrowserException-Problem with connection to browser due to closing of browser or invalid remote server address
  22.  UnableToSetCookieException-Thrown when a driver fails to set a cookie.
  23. InvalidCookieDomainException-Thrown when attempting to add a cookie under a different domain than the current URL.
  24. NoSuchSessionException-Thrown by any command being called after WebDriver.quit().
  25. InvalidElementStateException-Indicates that a WebElement is in a state that means actions cannot be performed with it


Post a Comment


  1. I have been searching for a useful post like this on salesforce course details, it is highly helpful for me and I have a great experience with this Salesforce Training who are providing certification and job assistance. Salesforce course in Gurgaon