Solution for java.lang.illegalstateexception in Selenium Webdriver

Hello Everyone Welcome back to Selenium Webdriver tutorial series. Today in this article we are going to discuss one exception which everyone has faced while working with other browsers.

By default, Selenium works with Firefox without any driver but while working with other browsers like Chrome, IE, Opera and so on we need to use third party drivers and specify the path of them.

You can download all third party driver from Selenium official website


 java.lang.illegalstateexception in Selenium Webdriver

The root cause of  java.lang.illegalstateexception is we have not specified the path of the driver with the system property.

Until you do not specify the driver details Selenium Webdriver will throw  java.lang.illegalstateexception.


I have faced a couple of exceptions while working with Selenium Webdriver and finally came across the solution for all.

Check below articles which will help you to understand which exceptions can come and how to handle them and it is one of the most important interview question as well.


What is exception ?

Type of Exceptions in Selenium Webdriver?

Handle Stale Element References Exception

Element not visible exception

F.QueryInterface is not a function


For java.lang.illegalstateexception we have to use System class and method called setProperty which will accept key and value pair.

For Chrome what changes we have to make



For IE Browser below changes has to be done


I do not have enough content for this because this exception is just because of small mistake.

If you would like to know how to start with IE and Chrome browser then below article will help you.


Execute Selenium Script in Chrome Browser

Execute Selenium Script in IE Browser. 


Please share your thoughts or view in the comment section.

For More updates Learn Automation page

For any query join Selenium group- Selenium Group



  1. Preetish Kumar Mahato
  2. karishma