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
- Download Chrome Driver from here.
- Add path (chrome driver location) to the system.set property as shown below.
- Execute the script.
System.setProperty(“webdriver.chrome.driver”, “SYSTEM PATH“);