线程" main"中的例外情况org.openqa.selenium.WebDriverException:java.net.SocketException:连接重置

时间:2017-09-02 16:45:27

标签: java google-chrome selenium

我试图调用Chrome并在Eclpise IDE中收到以下错误消息:

line = proc.stdout.readline().decode()

这是我的代码:

C:\Users\XXXX\Downloads\chromedriver_win32\chromedriver.exe
Starting    Driver (v2.9.248315) on port 38763
Sep 02, 2017 10:58:30 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detectedr dialect: OSS
Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'XXXX', ip: 'XXXXX', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:646)
    at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:370)
    at Learn1.main(Learn1.java:15)
Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
    at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
    at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:282)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
    at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
    at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:139)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:87)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:161)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    ... 3 more

我正在使用

  • Chromedriver 2.9
  • Chrome版本60
  • Selenium v​​ersion 3.5.3

Chrome正在打开,但不会导航到gmail.com。 Chrome也会发出警告,禁用开发者模式扩展程序。

2 个答案:

答案 0 :(得分:0)

我使用的是2.9 chrome版本,这不是最新版本。 2.32 V是最新的,使用后问题解决了。

答案 1 :(得分:0)

使用chromedriver的最新版本,即2.32

从这里下载:

https://sites.google.com/a/chromium.org/chromedriver/downloads