加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Docker selenium/node-chrome – 量角器找不到Chrome二进制文件

发布时间:2020-12-16 03:35:10 所属栏目:安全 来源:网络整理
导读:我是Docker的新手,但不是E2E量角器.我正在尝试用docker容器构建E2E集成. 继Angulars protractor cookbook using Docker之后 他们有Step 2 Starting Selenium Nodes docker run -d link selenium-hub:hub selenium / node-chrome:latest 我了解Selnium Grid

我是Docker的新手,但不是E2E量角器.我正在尝试用docker容器构建E2E集成.

继Angular’s protractor cookbook using Docker之后

他们有Step 2 – Starting Selenium Nodes

docker run -d –link selenium-hub:hub selenium / node-chrome:latest

我了解Selnium Grid的功能 – 它允许通过与网格通信来测试不同类型的浏览器.

当我有这个运行Proteror的docker容器不使用它作为chrome二进制文件时我得到WebDriverError:未知错误:找不到Chrome二进制文件.

如何使量角器使用此节点铬容器而不是本地chrome二进制文件?

我的量角器配置:

exports.config = {
  framework: 'mocha',directConnect: true,seleniumAddress: 'http://localhost:4444/wd/hub',// I have this set to the grid docker container from Angular cookbook
  specs: ['./stories/*.js'],onPrepare: function() {
    expect = require("chai").use(require("chai-as-promised")).expect;
  },mochaOpts: {
    enableTimeouts: false,reporter: "spec",slow: 7000
  },capabilities: {
    browserName: 'chrome'
  }
}

这就是我在无头服务器(非docker)上运行量角器的方法xvfb-run node_modules / protractor / bin / protractor e2e / protractor.conf.js

最佳答案
我发现了问题…我在量角器配置中删除了directConnect:true,这使得它可以在没有本地chrome二进制文件的情况下运行.解决方案是将其伪造或删除它.

来自docs:

directConnect: true – Your test script communicates directly Chrome Driver or Firefox Driver,bypassing any Selenium Server. If this is true,settings for seleniumAddress and seleniumServerJar will be ignored. If you attempt to use a browser other than Chrome or Firefox an error will be thrown

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读