Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker selenium/node-chrome - Protractor can not find Chrome binary

I am a newbie to Docker, but not to E2E protractor. I am trying to build E2E integration out of docker containers.

Following Angular's protractor cookbook using Docker

They have Step 2 - Starting Selenium Nodes with

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

I understand what Selnium Grid does - it allows browsers of different types to be tested by communicating with the grid.

When I have this docker container running Protactor does not use it as a chrome binary and I get WebDriverError: unknown error: cannot find Chrome binary.

How do I make protractor use this node-chrome container and not the local chrome binary?

My protractor config:

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'
  }
}

This is how I run protractor on my headless server(non docker) xvfb-run node_modules/protractor/bin/protractor e2e/protractor.conf.js

like image 631
dman Avatar asked Dec 27 '16 21:12

dman


1 Answers

I found the issue... I removed directConnect: true in the protractor config and this allowed it to run without a local chrome binary. The solution is to make this false or remove it.

From 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

like image 135
dman Avatar answered Oct 17 '22 04:10

dman