Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Selenium by (7k points)

The connection with chromedriver is not working, when I launch the test and try click a simple button I get this:

Error: ChromeDriver did not start within 5000ms at Error (native)
at node_modules/spectron/lib/chrome-driver.js:58:25 at Request._callback (node_modules/spectron/lib/chrome-driver.js:116:45) at Request.self.callback (node_modules/spectron/node_modules/request/request.js:200:22) at Request. (node_modules/spectron/node_modules/request/request.js:1067:10) at IncomingMessage. (node_modules/spectron/node_modules/request/request.js:988:12) at endReadableNT (_stream_readable.js:913:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9)

My code:

"use strict";

require("co-mocha");

var Application = require('spectron').Application;

var assert = require('assert');

const webdriver = require('selenium-webdriver');

const driver = new webdriver.Builder()

  .usingServer('http://127.0.0.1:9515')

  .withCapabilities({

    chromeOptions: {

      binary: "./appPath/app"

    }

  })

  .forBrowser('electron')

  .build();

describe('Application launch', function () {

  this.timeout(100000);

  var app;

  beforeEach(function () {

    app = new Application({

      path: "./appPath/app"

    });

    return app.start();

  });

  afterEach(function () {

    if (app && app.isRunning()) {

      return app.stop();

    }

  })

  it('click a button', function* () {

    yield driver.sleep(5000);

    yield driver.findElement(webdriver.By.css(".classSelector")).click();

  });

});

 

 

1 Answer

0 votes
by (31.9k points)

You can use Spectron or WebdriverJS for you test.

If you are using WebdriverJS, then run

./node_modules/.bin/chromedriver

 in this step.

Want to learn Selenium, checkout our Selenium training.

Browse Categories

...