Selenium Exceptions

The very frequent Selenium Exceptions which we will see while automating the applications are as below,

  1. NoSuchElementException
  2. NoSuchFrameException
  3. NoSuchWindowException
  4. ElementNotVisibleException
  5. StaleElementReferenceException
  6. InvalidElementStateException
  7. UnreachableBrowserException
  8. SessionNotFoundException

NoSuchElementException: The Element you are trying to find does not exist.

NoSuchFrameException: The Iframe on application you are trying to find does not exist.

NoSuchWindowException: The Window is not present which you are trying to find.

ElementNotVisibleException: The WebElement that you trying to interact with is not visible to the user.

StaleElementReferenceException: This is an exception that you will quite often see when you work with AJAX or heavy JavaScript websites, where the DOM is continually being changed. When the element is no longer attached to the DOM then you will face the exception.

InvalidElementStateException: When you try to interact with any element then an unexpected popup will come but we are not sure why and what it is. An InvalidElementStateException is thrown when the WebElement that you are trying to interact with is not in a state would allow you to perform the action that you would like to perform.

UnreachableBrowserException: As we know the selenium sends commands to the browser to execute and get the response back. Sometimes we will not get the response from the browser then we will get UnreachableBrowserException.

SessionNotFoundException: While you executing your tests and something will go wrong and will lose connection with the browser instance that you are driving then you will get this exception.

This is a open-source international community to improve software testing practices, send your post here


Leave a Reply