首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用CicrcleCI的WebdriverIO -获取chromedriver版本的错误

使用CicrcleCI的WebdriverIO -获取chromedriver版本的错误
EN

Stack Overflow用户
提问于 2020-08-27 22:29:18
回答 2查看 688关注 0票数 1

我正在尝试在CircleCI上使用cucumber框架运行webdriverIO测试,但是在执行测试命令时遇到了一个问题--

这是我正在使用的circleCI config.yml -

代码语言:javascript
复制
version: 2.1

jobs:
  build:
    docker:
    
    - image: circleci/node:10-browsers
    working_directory: ~/project
     
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "package.json" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - run:
          name: "Install dependencies"
          command: |
            npm install
      - save_cache:
          paths:
            - node_modules
          key: v1-dependencies-{{ checksum "package.json" }}

      - run:
          name: "Run tests"
          command: |
           npm run test


      - store_test_results:
          path: ./allure-results

这是我的wdio.conf.js-

代码语言:javascript
复制
exports.config = {
    //
    // ====================
    // Runner Configuration
    // ====================
    //
    // WebdriverIO allows it to run your tests in arbitrary locations (e.g. locally or
    // on a remote machine).
    runner: 'local',
    hostname: 'localhost',
    port: 4444,
   
    specs: [
        './features/**/*.feature'
    ],
    // Patterns to exclude.
    exclude: [
        // 'path/to/excluded/files'
    ],
   
    maxInstances: 10,
    
    capabilities: [{
    
       
        maxInstances: 5,
        browserName: 'chrome',
        acceptInsecureCerts: true
       
    }],
    
    logLevel: 'info',
   
    bail: 0,
   
    baseUrl: 'http://localhost',
    
    waitforTimeout: 10000,
   
    connectionRetryTimeout: 120000,
    
    connectionRetryCount: 3,
    
    services: ['selenium-standalone'],
  capabilities: [{
    maxInstances: 5,
    browserName: 'chrome',
  }],
  args: {
    drivers: {
        chrome: { version: '83.0.4103' },
     
    }
},



   framework: 'cucumber',
   
    reporters: ['spec','allure'],
    reporterOptions: {
        allure: {
            outputDir: './reports/allure-results'
        }

    },

 
    cucumberOpts: {
        require: ['./features/step-definitions/steps.js'],
        backtrace: false,
        requireModule: ['@babel/register'],
        dryRun: false,
        failFast: false,

格式化程序输出(可重复)格式:'pretty',//隐藏挂起步骤的步骤定义代码段: true,//隐藏源uris源: true,// (name)指定要使用profile的配置文件:[],//如果存在任何未定义或挂起的步骤,请严格执行: false,// ( expression )仅执行具有与表达式tagExpression匹配的标记的功能或方案:'@runnow1',//步骤定义超时: 60000,//启用此配置以将未定义的定义视为警告。ignoreUndefinedDefinitions: false },

代码语言:javascript
复制
}


This is the stack trace of the error I am getting in circleCi-

[0-2] 2020-08-27T14:09:27.770Z ERROR webdriver: session not created: session not created: This version of ChromeDriver only supports Chrome version 83
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'f5e174502751', ip: '172.19.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1077-aws', java.version: '11.0.6'
Driver info: driver.version: unknown
remote stacktrace: #0 0x561324a36579 <unknown>

    at getErrorFromResponseBody (/home/circleci/project/node_modules/webdriver/build/utils.js:121:10)
    at WebDriverRequest._request (/home/circleci/project/node_modules/webdriver/build/request.js:149:56)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[0-2] 2020-08-27T14:09:27.770Z ERROR @wdio/runner: Error: Failed to create session.
session not created: This version of ChromeDriver only supports Chrome version 83
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'f5e174502751', ip: '172.19.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1077-aws', java.version: '11.0.6'
Driver info: driver.version: unknown
remote stacktrace: #0 0x561324a36579 <unknown>

    at startWebDriverSession (/home/circleci/project/node_modules/webdriver/build/utils.js:45:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[0-2]  Error:  Failed to create session.
session not created: This version of ChromeDriver only supports Chrome version 83
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'f5e174502751', ip: '172.19.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1077-aws', java.version: '11.0.6'
Driver info: driver.version: unknown
remote stacktrace: #0 0x561324a36579 <unknown>
EN

回答 2

Stack Overflow用户

发布于 2020-09-02 05:17:57

这是WebdriverIO用来下载正确版本的Chromedriver的依赖项中最近的一次回归。here导致WebdriverIO问题。

在该问题中建议的临时解决方法是告诉selenium-service在wdio配置中使用特定版本的Chromedriver:

代码语言:javascript
复制
services: [
    [
      "selenium-standalone",
      {
        logPath: "logs",
        installArgs: {
          version: "3.141.5",
          baseURL: "https://selenium-release.storage.googleapis.com",
          drivers: {
            chrome: {
              version: "85.0.4183.83",
              arch: process.arch,
              baseURL: "https://chromedriver.storage.googleapis.com",
            },
          },
        },
        args: {
          version: "3.141.5",
          drivers: {
            chrome: {
              version: "85.0.4183.83",
              arch: process.arch,
            },
          },
        },
      },
    ],
],
票数 0
EN

Stack Overflow用户

发布于 2020-09-21 16:30:02

我建议在Chrome浏览器中使用预先构建的镜像,或者看看它是如何在Dockerfile文件中构建的,例如https://hub.docker.com/r/atools/chrome-headless

下面是一个示例存储库,您可以在其中查看流水线https://github.com/mgrybyk/wdio-jasmine-boilerplate中传递的测试

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63618236

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档