Chromedriver

Chromedriver is probably the easiest way to get up and running locally. It's also conveniently free. This doesn't work well in headless environments (like CI servers), but is a great way to do a quick check of your tests in a local browser, where you can see everything that's going on.

Start by installing chromedriver:

npm install chromedriver --save-dev

Then you can test using code like:

import assert from 'assert';
import cabbie, {startChromedriver} from 'cabbie-sync';

// Start the chromedriver server, this provides a local selenium server
// You must install chromedriver to use this.
startChromedriver();

// connect to chromedriver, adding {debug: true} makes cabbie log each method call.
const driver = cabbie('chromedriver', {debug: true});

try {
  // navigate to a url in the currently active window
  driver.activeWindow.navigateTo('http://example.com');

  // get an element, and check that its text equals some expected value
  assert.equal(
    driver.activeWindow.getElement('h1').getText(),
    'Example Domain',
  );
} finally {
  // whether tests pass or fail, dispose of the driver
  driver.dispose();
}