Skip to content

Instantly share code, notes, and snippets.

@fatihky
Created May 11, 2016 00:59
Show Gist options
  • Save fatihky/ea182fc11ddee7090ff9b7cd854d66b9 to your computer and use it in GitHub Desktop.
Save fatihky/ea182fc11ddee7090ff9b7cd854d66b9 to your computer and use it in GitHub Desktop.
nightmare.js example
var Nightmare = require('nightmare');
var vo = require('vo');
vo(run)(function(err, result) {
if (err) throw err;
});
function *run() {
var nightmare = Nightmare();
var title = yield nightmare
.goto('http://cnn.com')
.evaluate(function() {
return document.title;
});
console.log(title);
yield nightmare.end();
}
DEBUG=nightmare xvfb-run --server-args="-screen 0 1024x768x24" node app.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment