面对seleniumwebdriver 2.48和chromedriver2.9的兼容性问题

时间:2017-01-24 09:41:15

标签: java maven selenium selenium-webdriver webdriver

我正在使用:

  1. Selenium Webdriver 2.48(通过Maven依赖)。
  2. chromedriver_win32.exe(2.27)。
  3. 爪哇。
  4. 最新更新版本 浏览器(chrome版本55.0.2883.87 m(64位),firefox 50.1.0)
  5. 当我尝试driver.get(ÜRL)

    它会打开浏览器,但不会打开网址。

    获取错误消息。

    Starting ChromeDriver (v2.4.226107) on port 45057
    Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
    Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
    System info: host: 'DESKTOP-DHGCEEC', ip: '192.168.1.106', os.name: 'Windows NT (unknown)', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0'
    Driver info: driver.version: RemoteWebDriver
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
        at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:311)
        at pageObjects.Login.main(Login.java:12)
    Caused by: org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
    Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
    System info: host: 'DESKTOP-DHGCEEC', ip: '192.168.1.106', os.name: 'Windows NT (unknown)', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0'
    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:620)
        ... 2 more
    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:139)
        at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155)
        at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
        at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
        at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
        at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
        at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
        at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
        ... 3 more
    

1 个答案:

答案 0 :(得分:0)

下载Chrome驱动程序v2.25。并设置驱动程序的完整路径。

System.setProperty("webdriver.chrome.driver", "F:\\Stuff\\Jars\\chromedriver.exe");