开发者问题收集

驱动程序信息:driver.version:未知,使用 ChromeDriver v78.0.3904.70 和 Chrome 浏览器 v78.0.3904.97

2019-11-18
27297

我正在使用 Java 1.8 和 Chrome 浏览器版本 78.0.3904.97 。我正尝试使用 Chrome 驱动程序版本 78.0.3904.70 执行我的 selenium 脚本代码。但在执行过程中,我遇到了以下问题,并且 Chrome 立即崩溃

Picked up JAVA_TOOL_OPTIONS: -Djdk.http.auth.tunneling.disabledSchemes=""
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

如果您检查以下日志,那么您就会知道我正在传递 78.0.3904.70 版本的 Chrome 驱动程序并尝试启动 78.0.3904.97 chrome 浏览器,这会产生问题。此外,如果您检查 https://chromedriver.chromium.org/downloads 链接,您将了解到 78.0.3904.97 版本的 chrome 驱动程序不可用

错误日志

Starting ChromeDriver 78.0.3904.70 (edb9c9f3de0247fd912a77b7f6cae7447f6d3ad5-refs/branch-heads/3904@{#800}) on port 22844
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Nov 18, 2019 12:06:32 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
12:06:32.350 [main] DEBUG net.serenitybdd.core.photography.Darkroom - Opening darkroom
12:06:32.360 [Darkroom Processing Line] DEBUG net.serenitybdd.core.photography.DarkroomProcessingLine - Darkroom processing line starting up
12:06:33.613 [main] DEBUG net.serenitybdd.core.photography.Darkroom - Send negative for processing for target\site\serenity\c5e0d5f762dd0408b347b1b56ece2682cce0d422c500276e3f33c78c87fadcf6.png
12:06:35.280 [main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - 


12:06:35.825 [main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - TEST FAILED AT STEP Launch browser and navigate to  URL
12:06:35.825 [main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - invalid argument



org.openqa.selenium.remote.UnreachableBrowserException: invalid argument
  (Session info: chrome=78.0.3904.97)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'UKF6-L015064', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 78.0.3904.97, chrome: {chromedriverVersion: 78.0.3904.70 (edb9c9f3de024..., userDataDir: C:\Users\DIPAK~1.BAC\AppDat...}, goog:chromeOptions: {debuggerAddress: localhost:52359}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 22ece16d3a54371674e778dca702876b
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'UKF6-L015064', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: driver.version: unknown

    at webapplication.contactlenses.pages.Homepage.navigateToBaseUrlNL(Homepage.java:530)
    at webapplication.contactlenses.steplib.ContactLensSteplib.navigate_to_baseUrlNL(ContactLensSteplib.java:28)
    at webapplication.contactlenses.steplib.ContactLensSteplib$$EnhancerByCGLIB$$916d3a70.CGLIB$navigate_to_baseUrlNL$16(<generated>)
    at webapplication.contactlenses.steplib.ContactLensSteplib$$EnhancerByCGLIB$$916d3a70$$FastClassByCGLIB$$c8d6c80f.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at net.thucydides.core.steps.StepInterceptor.invokeMethod(StepInterceptor.java:461)
    at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:446)
    at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:421)
    at net.thucydides.core.steps.StepInterceptor.runOrSkipMethod(StepInterceptor.java:176)
    at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:163)
    at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:69)
    at webapplication.contactlenses.steplib.ContactLensSteplib$$EnhancerByCGLIB$$916d3a70.navigate_to_baseUrlNL(<generated>)

我已经检查过 chrome 驱动程序版本 78.0.3904.97 ,但它不可用。有人可以指导我解决这个问题吗?

2个回答

Chromedriver 版本应显示在日志中

 Driver info: driver.version: unknown 

您是否为 chromedriver.exe 设置了正确的路径。请验证。

System.setProperty("webdriver.chrome.driver", "C:/PathToChromeDriver/chromedriver.exe");
Ishan
2019-11-18

此错误消息...

org.openqa.selenium.remote.UnreachableBrowserException: invalid argument
  (Session info: chrome=78.0.3904.97)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'UKF6-L015064', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: true, browserName: chrome, browserVersion: 78.0.3904.97, chrome: {chromedriverVersion: 78.0.3904.70 (edb9c9f3de024..., userDataDir: C:\Users\DIPAK~1.BAC\AppDat...}, goog:chromeOptions: {debuggerAddress: localhost:52359}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 22ece16d3a54371674e778dca702876b
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'UKF6-L015064', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_131'
Driver info: driver.version: unknown

...意味着 ChromeDriver 无法启动/生成新的 WebBrowser ,即 Chrome Browser 会话。

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

  • 虽然您使用的是 chromedriver=78.0.3904.97
  • 并且您还使用了 chrome=78.0.3904.97
  • 您的 Selenium Client 版本也是 3.141.59
  • 您的 JDK 版本 1.8.0_131 ,非常古老。

因此, JDK v8u131 Selenium Client v3.141.59 ChromeDriver v78.0.3904.97 Chrome Browser v78.0.3904.97 之间存在明显不匹配。>


解决方案

确保:

  • JDK 已升级到当前级别 JDK 8u222
  • 通过 IDE 清理 您的 项目工作区 ,并使用所需的依赖项 重建 您的项目仅。
  • 如果您的基本 Web Client 版本太旧,请卸载它并安装最新的 GA 和发布版本的 Web Client
  • 进行 系统重启
  • 非 root 用户身份执行您的 @Test
undetected Selenium
2019-11-18