gpt4 book ai didi

java - 使用 Selenium Webdriver 的 IE 浏览器 : "The driver executable is a directory"

转载 作者:行者123 更新时间:2023-11-29 03:12:02 24 4
gpt4 key购买 nike

尝试使用 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");

如果有帮助请告诉我

关于java - 使用 Selenium Webdriver 的 IE 浏览器 : "The driver executable is a directory",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28824540/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com