title: How to test an Electron app with selenium webdriver
body: <p>I have read the documentation and I have followed the tutorial step by step and I only have managed to run the app.</p>
  
  <ul>
  <li>Documentation: <a href="http://electron.atom.io/docs/tutorial/using-selenium-and-webdriver/" rel="nofollow">http://electron.atom.io/docs/tutorial/using-selenium-and-webdriver/</a></li>
  </ul>
  
  <p>The connection with chromedriver I cannot make it work, when I launch the test and try click a simple button I get this: </p>
  
  <blockquote>
    <p>Error: ChromeDriver did not start within 5000ms   at Error (native)<br>
    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)</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><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 &amp;&amp; app.isRunning()) {
        return app.stop();
      }
    });
  
    it('click a button', function* () {
      yield driver.sleep(5000);
      yield driver.findElement(webdriver.By.css(".classSelector")).click();
    });
  });
  </code></pre>
  
  <p>Thanks and sorry for my English.</p>