Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: ChromeDriver did not start within 5000ms #144

Closed
devwithin opened this issue Nov 28, 2016 · 24 comments
Closed

Error: ChromeDriver did not start within 5000ms #144

devwithin opened this issue Nov 28, 2016 · 24 comments

Comments

@devwithin
Copy link

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
@Siilwyn
Copy link

Siilwyn commented Dec 13, 2016

I'm having the same issue but on a Docker container running node:6.
Simplified commands I run before testing are:

 - "apt install -y xvfb"
 - "export DISPLAY=:99.0"
 - "Xvfb &"
 - "sleep 3"

Maybe relevant I'm running my tests without building the app. Like:

new Application({
    path: path.resolve(__dirname, '../node_modules/.bin/electron'),
    args: [path.resolve(__dirname, '../')],
});
  • Electron 1.3.3
  • Spectron 3.4.0
  • Ava 0.17.0

@armoucar
Copy link

Same issue... 'ChromeDriver did not start within 5000ms'

@armoucar
Copy link

armoucar commented Dec 17, 2016

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

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

@Siilwyn
Copy link

Siilwyn commented Dec 17, 2016

Sadly that did not solve the issue for me. @armoucar how is that related? Maybe I can try out some other things related to it.

@armoucar
Copy link

At work I have to have proxies configuration on my terminal and I think ChromeDriver is a server running locally... When at home, with all proxies deactivated, I tested the same project I was trying to run the tests and it worked normally. I could then assume it was a proxy problem, in my case.

@jwood803
Copy link

jwood803 commented Dec 20, 2016

@devwithin @armoucar Is the application not starting at all when running the tests? I have a demo repo if you want to reference that to see if it works for you.

@armoucar
Copy link

In my environment you demo works fine, as long as I set my locahost,127.0.0.1 proxy exceptions.

@Siilwyn
Copy link

Siilwyn commented Dec 22, 2016

@jwood803 your demo doesn't work for me but it seems to be an issue in the test file:
https://gitlab.com/Siilwyn/spectron-test-gh-project/builds/7790833

@devwithin
Copy link
Author

@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.

@jwood803
Copy link

@Siilwyn Interesting! I haven't seen that error locally. Simple fix, though :)

@Siilwyn
Copy link

Siilwyn commented Jan 1, 2017

Can this be re-opened please? I'm still struggling with the same problem.
The logs: https://gitlab.com/Siilwyn/try-building-electri/builds/8062089

Or should I open a new issue?

@devwithin
Copy link
Author

@Siilwyn I'll reopen this issue as your problem looks very similar to mine.

I suspect that this might be because of some network or proxy config problem.

@devwithin devwithin reopened this Jan 4, 2017
@Siilwyn
Copy link

Siilwyn commented Jan 4, 2017

@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.

@jwood803
Copy link

jwood803 commented Jan 4, 2017

That is weird, indeed. I've never even needed to use that in any of my tests.

@Siilwyn
Copy link

Siilwyn commented Jan 5, 2017

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! 🎉

@akashnimare
Copy link

@Siilwyn could you please tell me why it's failing - logs - https://travis-ci.org/zulip/zulip-electron/jobs/189773598

@Siilwyn
Copy link

Siilwyn commented Jan 7, 2017

@akashnimare your error is not related to the issue described above. And sorry I don't know why it's failing.

@BenBergman
Copy link

I'm experiencing the same error as Siilwyn, but when I try to install the packages he mentions I get errors that such packages do not exist. I am using the node:9 docker container instead of 6. The proxy solution is also not working for me.

@BenBergman
Copy link

I ended up using a different docker image which was already setup for doing headless electron testing: aheuermann/electron

@gireeshcse
Copy link

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

@HaNdTriX
Copy link

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

yarn install --force

@artemv
Copy link

artemv commented Feb 1, 2019

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)

@daisyjanepueblos
Copy link

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!

hopskipnfall pushed a commit to hopskipnfall/dialog that referenced this issue May 2, 2021
@majedur-rahaman
Copy link

I just removed that runner and started fresh one. New Runner downloaded Spectron and ChromeDriver on start and Chrome worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests