自动化测试错误:org.openqa.selenium.WebDriverException:disconnected:无法连接到渲染器

时间:2018-02-06 11:29:34

标签: java google-chrome selenium selenium-webdriver selenium-chromedriver

我是自动化测试的新手,我面临以下错误。我无法继续下去。有人可以帮我解决这个问题: {错误}

Starting ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8) on port 47649
Only local connections are allowed.
Feb 06, 2018 4:48:10 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.WebDriverException: disconnected: unable to connect to renderer
  (Session info: chrome=64.0.3282.140)
  (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.03 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ALPSCMO-QA10', ip: '10.50.7.126', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8), userDataDir=C:\Users\manand\AppData\Local\Temp\scoped_dir6152_17631}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=64.0.3282.140, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]
Session ID: 3afbe7096bc143edfa25f5ae8616b830
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:694)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:925)
    at AutomationFramework.FirstTestClass.main(FirstTestClass.java:19)

2 个答案:

答案 0 :(得分:2)

错误说明了一切:

Exception in thread "main" org.openqa.selenium.WebDriverException: disconnected: unable to connect to renderer
  (Session info: chrome=64.0.3282.140)
  (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.1.7601 SP1 x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.03 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'ALPSCMO-QA10', ip: '10.50.7.126', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.chrome.ChromeDriver

您的主要问题是您使用的二进制文件中的版本兼容性,如下所示:

  • 您正在使用 chromedriver=2.31
  • chromedriver=2.31的发行说明明确提及以下内容:
  

<强> Supports Chrome v58-60

  • 您正在使用 chrome=64.0
  • ChromeDriver v2.35的发行说明明确提及以下内容:
  

<强> Supports Chrome v62-64

  • 您的 Selenium Client 未被检测到,因此我们无法知道 Selenium Client 版本。
  • JDK version 1.8.0_112 ,这是非常古老的。

因此 JDK版 Selenium客户端版 ChromeDriver 版本( v2.31 em>)和 Chrome浏览器版本( v64.0

解决方案

  • JDK升级到最近的级别 JDK Version 8 Update 151
  • Selenium升级到当前级别 Version 3.8.1
  • ChromeDriver升级为 ChromeDriver v2.35 级别。
  • Chrome保持在 Chrome v64.x 级别。 (as per ChromeDriver v2.35 release notes
  • 如果您的基本 Chrome 版本太旧,请通过Revo Uninstaller将其卸载并安装最新的GA和已发布的Chrome版本。
  • 执行Test

答案 1 :(得分:0)

您应该更新到2.33的最新ChromeDriver。希望它能解决你的问题。