selenium启动IE报错:The path to the driver executable must be set by the webdriver.ie.driver system property;
1.selenium启动IE报错:The path to the driver executable must be set by the webdriver.ie.driver system property;
A.具体的报错内容是:
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
B.代码具体的写法:
C.解决方法是:
需要先使用System.setProperty 去设置IE 的 IEDriver 路径,再去创建 IEDriver
具体是代码演示:
System.setProperty("webdriver.ie.driver", "D:\\selenium\\IEDriverServer.exe");
InternetExplorerDriver driver = new InternetExplorerDriver();
其中:D:\\selenium\\IEDriverServer.exe" 为你存放的IEDriver 的路径
以上解决方法参考了:http://www.cnblogs.com/xmmc/p/7634499.html