使用IEDriverServer 3.9.0.0运行硒时无法启动IE 11 [英] Unable to launch IE 11 when running selenium with IEDriverServer 3.9.0.0

查看:98
本文介绍了使用IEDriverServer 3.9.0.0运行硒时无法启动IE 11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行硒测试时,我在启动IE 11时遇到问题.这是我用来设置浏览器的代码

I'm having issues launching IE 11 when I run my selenium tests. Here is the code I am using to setup my browser

 if (browser.equalsIgnoreCase("ie")) {
        System.setProperty("webdriver.ie.driver",  "IEDriverServer.exe");
        driver = new InternetExplorerDriver();
    } else {
        throw new Exception("Browser is not correct");
    }
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.get("https://www.google.com/");
    Dimension dimension = new Dimension(800,600);
    driver.manage().window().setSize(dimension);
}

我尝试了基于此线程的其他解决方案,但仍然没有运气. 堆栈链接.有什么我可以使用的解决方案吗?

I tried the other solutions base off this thread but still no luck. Stack Link. Is there any solutions I can use?

环境:
硒版本:3.12.0
IEDriverServer版本:3.9.0.0
IE版本:11.0.65

Environment:
Selenium version: 3.12.0
IEDriverServer version: 3.9.0.0
IE Version: 11.0.65

控制台输出:

 Started InternetExplorerDriver server (64-bit)
 3.9.0.0
 Listening on port 10696
 Only local connections are allowed

堆栈跟踪:

  org.openqa.selenium.WebDriverException: java.net.SocketException: 
  Connection reset
  Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-      08T14:04:26.12Z'
  System info: host: 'DESKTOP7', ip: '', os.name: '      Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
  Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:223)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:215)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:152)
at com.dlp.tests.TestCases.Basic_Template.setup(Basic_Template.java:37)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at       java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at       java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
  Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at okio.Okio$2.read(Okio.java:139)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:237)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:345)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:217)
at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:212)
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:105)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:101)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)

推荐答案

此错误消息...

org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset

...表示 IEDriverServer 无法启动/产生新的 WebBrowsing会话,即 InternetExplorer Browser 会话.

...implies that the IEDriverServer was unable to initiate/spawn a new WebBrowsing Session i.e. InternetExplorer Browser session.

您的主要问题是所使用的二进制文件版本之间的不兼容性:

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • 您的 Selenium Client 版本是 2018-05-08T14:04:26.12Z 3.12.0 ,该版本已有近一年的历史了.
  • 您的 InternetExplorerDriver 版本 3.9.0.0 .
  • Your Selenium Client version is 3.12.0 of 2018-05-08T14:04:26.12Z which is almost an year older.
  • Your InternetExplorerDriver version 3.9.0.0.

因此 Selenium Client v3.12.0 InternetExplorerDriver v3.9.0.0 之间显然不匹配.按照 Selenium Client InternetExplorerDriver 最佳做法同步发布,您必须同时使用相同主要版本中的两个二进制文件.

So there is a clear mismatch between the Selenium Client v3.12.0 and InternetExplorerDriver v3.9.0.0. As per best practices as Selenium Client and InternetExplorerDriver are released in sync you must use both the binaries from the same major release.

进一步的 InternetExplorerDriver服务器v3.9.0.0 具有以下已知问题:

Further InternetExplorerDriver server v3.9.0.0 had a known issue as per the following references:

  • Can't launch Selenium IE Driver after upgrading to version 3.9
  • Selenium Java Client (v3.9.1) with IEDriverServer v3.9.0.0 (64-bit) crashes with org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:28286

此问题已通过以下提交得到解决:

This issue have been addressed through the following commit:

  • IEDriverServer 升级到当前的 IEDriverServer v3. 12.0 级别.
  • 通过 IDE
  • 清理您的项目工作区重建您的项目,并且仅具有必需的依赖项.
  • 使用 CCleaner 工具清除之前和之后的所有操作系统杂项在执行 test Suite 之后.
  • 进行系统重启.
  • 执行您的@Test.
  • 始终在tearDown(){}方法中调用driver.quit()以关闭&优雅地销毁 WebDriver Web Client 实例.
  • Upgrade IEDriverServer to current IEDriverServer v3.12.0 level.
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
  • Take a System Reboot.
  • Execute your @Test.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

这篇关于使用IEDriverServer 3.9.0.0运行硒时无法启动IE 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆