Selenium Webdriver Appium Complete TutorialSelenium Webdriver Appium Complete Tutorial
Automation Testing
  • Tools
    • Selenium
      • Selenium Java Tutorial
      • Selenium C# Tutorial
    • Appium
      • Appium Java Tutorial
      • Appium C#Tutorial
    • Katalon
  • Trainings
  • TestNG
  • Reports
    • Extent Reports
      • Extent Reports – Java
      • Extent Reports – Java -Version3
      • Extent Reports – C#
    • Vigo Reports
    • AT Excel Report
  • Excel
    • Apache POI – Java
    • Excel With C#
  • Interview Questions
    • Selenium Interview Questions
    • Java Interview Questions
    • C# Interview Questions
  • Demo Site
  • Practice Site
  • More…
    • AutoIt
    • Sikuli
    • Robot Class
    • File Upload
    • ScreenShot
      • AShot
      • ShutterBug
  • About
December 11, 2016

Selenium WebDriver Exceptions





Selenium Webdriver exceptions will discuss about what kind of exception we will get in selenium webdriver while executing the automation scripts. An exception is an infallible statement; it will always tell you why something has gone wrong in the code. It may not always be easy to understand the exception, but it does always tell the information about the what is wrong in the code.

One of the good things in selenium is while looking into the exception we will come to know what went wrong as the exception names will give some what clear picture for the error which we will face.

Below are some of the Exceptions which we will see while automating the applications:

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

Now we will see briefly about these exceptions:

NoSuchElementException:

This is the most and frequent facing exception. You will definitely find this kind of exception while automating the application. The reason for this exception is, the element you are trying to find does not exist.

NoSuchFrameException:

This is also most and frequent facing exception. In modern applications people are using iFrames very frequently. When you try to find an iFrame on application and it is not exist in the application then code will throw NoSuchFrameException.

NoSuchWindowException:

This is also very similar to the previous exception. A Window is a browser which is opened by the webdriver or child window(i.e.another browser opened from the parent browser). When you try find a Window and that is not available at present, then the code will throw NoSuchWindowException.

ElementNotVisibleException:

This is also most and very frequent facing exception. This ElementNotVisibleException tells you that the WebElement that you are 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 this exception.

InvalidElementStateException:

This exception you can not find very frequently. 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 that would allow you to perform the action that you would like to perform.

UnreachableBrowserException:

Sometimes you will face this type of Exception. As we know that 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:

You will not get this kind of exception frequently. But 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 SessionNotFoundException.

These are the most frequently exceptions we will face while automating any kind of application.

Please watch the YouTube video for this blog for better understanding.



Share this post: on Twitter on Facebook on Google+

TestNG Introduction Selenium NoSuchElementException

Related Posts

TAKING WEB ELEMENT SCREENSHOT IN SELENIUM

Selenium - Java

How to Capture WebElement Screenshot in Selenium Webdriver using selenium 4

avoid Switch to window

Selenium - Java

How to Avoid Switch To Window in Selenium WebDriver

webdrivermanager

Selenium - Java

No More Driver EXE files for Selenium Execution – Instead Use WebDriverManager

HANDLE TEXTBOXES IN SELENIUM

Selenium - Java

Handling Textboxes in Selenium

JAVASCRIPTEXECUTOR IN SELENIUM

Selenium - Java

JavaScriptExecutor in Selenium

ELEMENT NOT VISIBLE EXCEPTION

Selenium - C#, Selenium - Java

Selenium ElementNotVisibleException

NOSUCHWINDOW EXCEPTIONS

Selenium - C#, Selenium - Java

Selenium NoSuchWindowException

NOSUCHFRAME EXCEPTIONS

Selenium - C#, Selenium - Java

Selenium NoSuchFrameException

NOSUCHELEMENT EXCEPTION

Selenium - C#, Selenium - Java

Selenium NoSuchElementException

HANDLING BASIC ELEMENTS IN SELENIUM

Selenium - C#, Selenium - Java

Handling Basic Elements in Selenium

Newsletter

Recent Posts

  • TAKING WEB ELEMENT SCREENSHOT IN SELENIUMHow to Capture WebElement Screenshot in Selenium Webdriver using selenium 4
    December 15, 2019
  • How To SWAP Two Numbers in Java Without using Temp VariableHow to SWAP Two Numbers in Java Without Temp variable or Without Third variable
    December 8, 2019
  • How to Swap Two Numbers in Java with Temp VariableHow to SWAP Two Numbers in Java using Temp Variable
    December 1, 2019
  • How to Read Properties file in JavaHow to Read Data From Properties File in Java
    November 27, 2019
  • Compare two arrays in java with out inbuilt functionsHow to Compare Two Arrays in Java without built-in functions
    November 16, 2019
© Selenium Webdriver Appium Complete Tutorial 2023