How to set chrome browser driver system property ? Selenium Webdriver chrome driver illegal state exception.

selenium webdriver exception

How do we solve chrome browser exception which says : Illegal state Exception and is related to chrome driver. While working with Firefox, there is no such error shown. This is applicable only while trying to execute in chrome browser. It’s a simple one step addition to the code as shown below.

Chrome browser Exception:

Exception in thread “main” java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html

Solution :

  1. Download Chrome Driver from here.
  2. Add path (chrome driver location) to the system.set property as shown below.
  3. Execute the script.

SYNTAX :

System.setProperty(“webdriver.chrome.driver”, “SYSTEM PATH“);

System.setProperty(“webdriver.chrome.driver”, “C:\\chromedriver_win32\\chromedriver.exe“);

 

Chrome Driver exception_ Selenium webdriver

Chrome Driver exception_ Selenium webdriver