1. 程式人生 > >Selenium:無法呼叫IE,報錯java.lang.IllegalStateException

Selenium:無法呼叫IE,報錯java.lang.IllegalStateException

在使用Selenium呼叫IE時報錯,java.lang.IllegalStateException:the path to the driver executable must be set by the webdriver system property;for more information,see https://github.....

先嚐試利用和chrome一樣解決方案,設定IEDriverServer到環境變數path中,未果。

後來在程式碼中指定webdriver路徑解決,具體如下

...
File file = new File("d:/Webdriver/IEDriverServer,exe");
System.setProperty("webdriver.ie.driver",file.getAbsolutePath());
WebDriver driver = new InternetExolorerDriver();
...