驱动程序信息:Driver.version:未知,使用ChromeDriver v78.0.3904.70和Chrome



我使用的是带有chrome浏览器版本78.0.3904.97的java 1.8。我正在尝试使用chrome驱动程序版本78.0.3904.70执行selenium脚本代码。但在执行过程中,我面临以下问题,铬立即崩溃

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 targetsiteserenityc5e0d5f762dd0408b347b1b56ece2682cce0d422c500276e3f33c78c87fadcf6.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:UsersDIPAK~1.BACAppDat...}, 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>)

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

Chromedriver版本应显示在日志中

Driver info: driver.version: unknown 

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

System.setProperty("webdriver.chrome.driver", "C:/PathToChromeDriver/chromedriver.exe");

此错误消息。。。

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:UsersDIPAK~1.BACAppDat...}, 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浏览器会话。

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

  • 尽管您使用的是chromedriver=78.0.3904.97
  • 您还使用铬=78.0.3904.97
  • 您的Selenium Client版本也是3.141.59
  • 您的JDK版本1.8.0_131,它非常古老

因此,JDK v8u131Selenium Client v3.141.59ChromeDriver v78.0.3904.97Chrome浏览器v78.0.390.97之间存在明显的不匹配


解决方案

确保:

  • JDK升级到当前级别JDK8u222
  • 通过IDE清理您的项目工作区,并仅使用所需的依赖项重建项目
  • 如果您的基本Web客户端版本太旧,请将其卸载并安装最新的GA和发布的Web客户端版本
  • 进行系统重新启动
  • 非root用户身份执行@Test

相关内容

  • 没有找到相关文章

最新更新