当前位置: 首页 > 面试题库 >

使用Nightwatch的Chromedriver错误“ Chrome版本必须> = 52”

宦文柏
2023-03-14
问题内容

我正在尝试安装Nightwatch,并且正在使用最新的chromedriver ,它表示支持chromev52-54。但是,当我尝试运行测试时,它说
'Error: Chrome version must be>=52.0.2743.'这是我正在使用的所有内容:

  • ChromeDriver 2.24
  • selenium2.53.1
  • nightwatchjsv0.9.8
  • nodejsv6.5.0
  • Java v1.7.0_111

项目结构

|-- nightwatch.json
|-- bin/
|   |-- chromedriver
|   |-- selenium-server-standalone-2.53.1.jar
|-- tests/
|   |-- sample.js
|-- results/
|-- screens/
|-- node_modules/
|   |-- (lots of modules here)

这是我的守夜人配置文件:

./nightwatch.json

{
  "src_folders" : ["tests"],
  "output_folder" : "results",
  "custom_commands_path" : "",
  "custom_assertions_path" : "",
  "page_objects_path" : "",
  "globals_path" : "",

  "selenium" : {
    "start_process" : true,
    "server_path" : "bin/selenium-server-standalone-2.53.1.jar",
    "log_path" : "results",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "bin/chromedriver"
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost",
      "html" target="_blank">selenium_port"  : 4444,
      "selenium_host"  : "localhost",
      "silent": true,
      "screenshots" : {
        "enabled" : true,
        "path" : "screens/"
      },
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    },

    "chrome" : {
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    }
  }
}

运行测试

我像这样运行测试:

nightwatch tests/

错误

我得到以下输出:

Starting selenium server... started - PID:  3500

[Sample] Test Suite
=======================

Running:  Demo test Google

Error retrieving a new session from the selenium server

Connection refused! Is selenium server started?
{ sessionId: null,
  status: 13,
  state: 'unhandled error',
  value: 
   { message: 'unknown error: Chrome version must be >= 52.0.2743.0\n  (Driver info: chromedriver=2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3),platform=Linux 3.2.0-56-generic x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 1.42 seconds\nBuild info: version: \'2.53.1\', revision: \'a36b8b1\', time: \'2016-06-30 17:37:03\'\nSystem info: host: \'N/A\', ip: \'N/A\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'3.2.0-56-generic\', java.version: \'1.7.0_111\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver',
     suppressed: [],
     localizedMessage: 'unknown error: Chrome version must be >= 52.0.2743.0\n  (Driver info: chromedriver=2.24.417424 (c5c5ea873213ee72e3d0929b47482681555340c3),platform=Linux 3.2.0-56-generic x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 1.42 seconds\nBuild info: version: \'2.53.1\', revision: \'a36b8b1\', time: \'2016-06-30 17:37:03\'\nSystem info: host: \'N/A\', ip: \'N/A\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'3.2.0-56-generic\', java.version: \'1.7.0_111\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver',
     buildInformation: 
      { releaseLabel: '2.53.1',
        buildTime: '2016-06-30 17:37:03',
        class: 'org.openqa.selenium.internal.BuildInfo',
        buildRevision: 'a36b8b1',
        hCode: 1900167016 },
     cause: null,
     systemInformation: 'System info: host: \'N/A\', ip: \'N/A\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'3.2.0-56-generic\', java.version: \'1.7.0_111\'',
     supportUrl: null,
     class: 'org.openqa.selenium.WebDriverException',
     additionalInformation: '\nDriver info: org.openqa.selenium.chrome.ChromeDriver',
     hCode: 1299270263,
     screen: null },
  class: 'org.openqa.selenium.remote.Response',
  hCode: 1144687147 }

有人知道如何解决此错误吗?

Chrome version must be>= 52.0.2743.0

chromedriver是否使用我的本地chrome副本?我需要更新实际的Chrome吗?


问题答案:

chromedriver是否使用我的本地chrome副本?我需要更新实际的Chrome吗?

是的,ChromeDriver是selenium webdriver用于控制chrome的可执行文件。

因此,selenium webdriver从默认位置或自定义位置启动已安装的chrome,在初始化过程中将其告知selenium webdriver
ChromeDriver

因此,基本上
ChromeDriver可执行文件只是用来在chrome浏览器和硒webdriver之间进行对话来控制它,并不意味着它会启动自己的chrome浏览器。它使用您安装的Chrome浏览器。

是的,您需要更新实际安装的Chrome。



 类似资料: