user2014 user2014 - 29 days ago 8
Java Question

Unable to launch IE browser - IllegalStateException while working with Internet Explorer browser in selenium

Exception in thread "main" java.lang.IllegalStateException :The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html
at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
at org.openqa.selenium.ie.InternetExplorerDriverService.access$0(InternetExplorerDriverService.java:1)
at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.findDefaultExecutable(InternetExplorerDriverService.java:167)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:251)
at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:146)
at SamplePackage.SampleClass.main(SampleClass.java:16)

Here is my code :
File file = new File("C://Users//ctsuser//Downloads//selenium//IEDriverServer//IEDriverServer.exe");
System.setProperty("Webdriver.ie.driver", file.getAbsolutePath() );
WebDriver driver = new InternetExplorerDriver();

Answer

As per provided code, you used Capital 'W' in setProperty. In thrown exception it saying use

'webdriver.ie.driver'

please change it. it will solve the issue.

Thank You, Murali