尝试使用Selenium Webdriver启动IE浏览器时出现以下错误。似乎是什么问题?

Exception in thread "main" java.lang.IllegalStateException: The driver executable is a directory: D:\Bhavesh\Bhavesh_Data\Study\Selenium\IEDriverServer_x64_2.45.0
    at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
    at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:119)
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:112)
    at org.openqa.selenium.ie.InternetExplorerDriverService.access$1(InternetExplorerDriverService.java:1)
    at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.build(InternetExplorerDriverService.java:247)
    at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:251)
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:172)
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:146)
    at first.IEDriver.main(IEDriver.java:11)

最佳答案

据我了解,当您为IEDriver位置设置属性时,您没有提到完整路径(完整目录路径,包括iedriver exe)

例如,请考虑以下问题。

如果将IEDriverServer.exe放在“ D:/ IEdriver”中,则必须按如下所示设置属性:

正确的方法:-System.setProperty(“ webdriver.ie.driver”,“ D:/IEdriver/IEDriverServer.exe”);

错误的方法:-System.setProperty(“ webdriver.ie.driver”,“ D:/ IEdriver”);

让我知道是否有帮助

09-13 03:03