List some common exceptions in Selenium WebDriver

Selenium exceptions are divided into two types including Checked Exceptions and Unchecked Exceptions. Here is the list of few common exceptions:

  1. ConnectionClosedException: This exception takes place when there is a disconnection in the driver.
  2. InvalidArgumentException: This Selenium exception is thrown if an argument does not belong to the expected type.
  3. InvalidSessionIdException: Takes place when the given session ID is not included in the list of active sessions, which means the session does not exist or is inactive either.
  4. ElementNotVisibleException: This exception is thrown when the element is present in DOM (Document Object Model), but not visible on the web page.
  5. ElementClickInterceptedException: The command could not be completed as the element receiving the events is concealing the element which was requested clicked.
  6. InvalidSwitchToTargetException: Happens if frame or window target to be switched does not exist.
  7. ElementNotInteractableException: This Selenium exception is thrown when an element is presented in the DOM but it is impossible to interact with such element.
  8. ElementNotSelectableException: This Selenium exception is thrown when an element is presented in the DOM but you can not be able to select. Hence, it is impossible to interact with.
  9. ErrorHandler.UnknownServerException: Exception is used as a placeholder if the server returns an error without a stack trace.
  10. ErrorInResponseException: This exception is thrown when a fault has occurred on the server side. You can see it happens when interacting with the Firefox extension or the remote driver server.
  11. ImeActivationFailedException: This exception occurs when IME engine activation has failed.
  12. ImeNotAvailableException: This exception takes place when IME support is unavailable.
  13. InsecureCertificateException: Navigation made the user agent to hit a certificate warning, which is caused by an invalid or expired TLS certificate.
  14. InvalidCookieDomainException: This happens when you try to add a cookie under a different domain rather than the current URL.
  15. InvalidCoordinatesException: This happens if the coordinates offered to an interacting operation are not valid.
  16. InvalidElementStateException: This Selenium exception occurs if a command cannot be finished as the element is invalid.
  17. JavascriptException: This problem happens when executing JavaScript supplied by the user.
  18. JsonException: Happens when you afford to get the session capabilities where the session is not created.
  19. MoveTargetOutOfBoundsException: Takes place if the target provided to the ActionChains move() methodology is not valid. For example: out of document.
  20. NoSuchAttributeException: Occurs when the attribute of element could not be found.
  21. NoSuchContextException: Happens in mobile device testing and is thrown by ContextAware.
  22. NoSuchCookieException: This exception is thrown if there is no cookie matching with the given path name found amongst the associated cookies of the current browsing context’s active document.
  23. NoSuchWindowException: Occurs if window target to be switch does not exist.
  24. NoSuchFrameException: Takes place if frame target to be switch does not exist.
  25. NoAlertPresentException: Happens when you switch to no presented alert.
  26. NoSuchElementException: This exception is thrown when an element with given attributes is not found on the web page.
  27. NotFoundException: This exception is subclass of WebDriverException. It happens when an element on the DOM does not exist.
  28. RemoteDriverServerException: This Selenium exception is thrown when server do not respond due to the problem that the capabilities described are not proper.
  29. ScreenshotException: It is impossible to capture a screen.
  30. ScriptTimeoutException: Thrown when executeAsyncScript takes more time than the given time limit to return the value.
  31. SessionNotCreatedException: A new session could not be successfully created.
  32. SessionNotFoundException: The WebDriver is performing the action right after you quit the browser.
  33. StaleElementException: This Selenium exception happens if the web element is detached from the current DOM. Also, This exception is thrown when the element is either deleted or no longer attached to the DOM.
  34. TimeoutException: This exception is thrown when a command performing an operation does not complete in the stipulated time.
  35. UnableToCreateProfileException: You can open a browser with certain options using profiles, but sometimes a new version of Selenium driverserver or browser may not support the profiles.
  36. UnableToSetCookieException: Occurs if a driver is unable to set a cookie.
  37. UnexpectedAlertPresentException: This Selenium exception happens when there is the appearance of an unexpected alert.
  38. UnexpectedTagNameException: Happens if a support class did not get a web element as expected.
  39. UnhandledAlertException: It happens when there is an alert, but WebDriver is unable to perform Alert operation.
  40. UnknownMethodException: Thrown when the requested command matching with a known URL but not matching with a methodology for that URL.
  41. UnreachableBrowserException: This Selenium exception happens if the browser is unable to be opened or have crashed because of some reasons.
  42. UnsupportedCommandException: Occurs when remote WebDriver does not send valid command as expected.
  43. WebDriverException: This takes place when the WebDriver is performing the action right after you close the browser.