spectron: Error: ChromeDriver did not start within 5000ms

I’m trying to run the getting started script from here (slightly modified).

const Application = require("spectron").Application;
const path = require("path");
const assert = require("assert");

const electronPath = require("electron");
const appPath = path.join(__dirname, "..");

const app = new Application({
  path: electronPath,
  args: [appPath]
});

describe("application launch", function () {
  this.timeout(15000);

  beforeEach(function () {
    return app.start();
  });

  afterEach(function () {
    if (app && app.isRunning()) {
      return app.stop();
    }
  });

  it("shows an initial window", function () {
    return app.client.getWindowCount().then(function (count) {
      assert.equal(count, 1);
    });
  });
});

I’ve tried to run this script but I’m getting following error

bash-3.2$ ./node_modules/.bin/mocha ./test/main.js 


  application launch
    1) "before each" hook for "shows an initial window"


  0 passing (6s)
  1 failing

  1) application launch "before each" hook for "shows an initial window":
     Error: ChromeDriver did not start within 5000ms
      at Error (native)
      at node_modules/spectron/lib/chrome-driver.js:63:25
      at Request._callback (node_modules/spectron/lib/chrome-driver.js:121:45)
      at Request.self.callback (node_modules/request/request.js:186:22)
      at Request.<anonymous> (node_modules/request/request.js:1081:10)
      at IncomingMessage.<anonymous> (node_modules/request/request.js:1001:12)
      at endReadableNT (_stream_readable.js:974:12)
      at _combinedTickCallback (internal/process/next_tick.js:74:11)
      at process._tickCallback (internal/process/next_tick.js:98:9)

I’m on osx 10.11 with

  • Electron 1.4.8
  • Spectron 3.4.0
  • Mocha 3.1.2
  • node 6.5 and npm 3.10

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 24

Commits related to this issue

Most upvoted comments

I had a similar problem, after switching from mocha to ava. Reinstalling all node_modules solved the issue for me.

yarn install --force

Alright I solved it on my end by installing display server related packages that are needed for chrome driver to run.

    # Install display server dependencies
    - "apt install xvfb libxtst6 libxss1 libgtk2.0-0 -y"
    # Install core libraries for chromium driver
    - "apt install libnss3 libasound2 libgconf-2-4 -y"

Think I’m going to find and try a docker image that already has the required chrome driver dependencies. Finally solved! 🎉

I could get ChromeDriver working by adding a proxy exception in my terminal.

export {no_proxy,NO_PROXY}="127.0.0.1,localhost"

In my case (spectron 5.0.0) solution was to run yarn upgrade spectron which upgraded webdriverio and some other spectron’ deps (but not spectron itself)

I had a similar problem, after switching from mocha to ava. Reinstalling all node_modules solved the issue for me.

yarn install --force

this helped me! thanks!

Same Issue Error: ChromeDriver did not start within 5000ms

In Windows set the environmental variable NO_PROXY to 127.0.0.1,localhost

This is a proxy problem as said by @armoucar thanks a lot @armoucar

@devwithin thank you! Would you know any way to get more debugging info out of it so I can check if it’s a network problem? It’s weird that export {no_proxy,NO_PROXY}="127.0.0.1,localhost" works for you but not for me.

@armoucar Thanks a lot. Your solution worked for me.

export {no_proxy,NO_PROXY}="127.0.0.1,localhost"

Turns out this was a problem with proxy setting.