Created
May 11, 2016 00:59
-
-
Save fatihky/ea182fc11ddee7090ff9b7cd854d66b9 to your computer and use it in GitHub Desktop.
nightmare.js example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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