小编典典

尝试使用IEDriver在Selenium Webdriver中启动UnreachableBrowserException

selenium

我有一套可以在Firefox和Chrome中完美运行的自动化程序,并且我也想启动IEDriver实例。

我已经按照Selenium的Google Code
Wiki
设置了IEDriver
,并使用了正确的路径(如果更改路径,则会得到不同的异常,因此这是绝对正确的)。但是由于某种原因,它仍然无法启动,只是超时了。

启动它的代码(最后一行引发异常):

        File ieDriver = new File("C:/Users/whatever/path/IEDriverServer.exe");
        System.setProperty("webdriver.ie.driver", ieDriver.getAbsolutePath());
        WebDriver ie = new InternetExplorerDriver();

唯一的例外是:

Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358', time: '2013-05-22 12:00:17'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_21'
Driver info: driver.version: InternetExplorerDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:201)
    at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:184)
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:174)
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:143)
    at uk.co.know.kiteTest.WebDriverManager.<init>(WebDriverManager.java:52)
    at uk.co.know.kiteTest.RunAutomations.main(RunAutomations.java:13)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358', time: '2013-05-22 12:00:17'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_21'
Driver info: driver.version: InternetExplorerDriver
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:62)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
    ... 7 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:38622/status] to be available after 20014 ms
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
    ... 9 more
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
    at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143)
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:79)
    ... 10 more

阅读 651

收藏
2020-06-26

共1个答案

小编典典

我遇到了同样的错误,然后发现了这个问题。就我而言,事实证明我的系统上有IEDriver.exe的64位版本,但我在32位Windows平台上。因此,此错误表明操作系统无法执行驱动程序。我试图直接在命令提示符下运行驱动程序,以查看32位操作系统实际上并未将64位驱动程序exe识别为可执行程序。

获取正确的32位IEDriver.exe解决了我的问题。

2020-06-26