Last active
July 21, 2016 18:58
-
-
Save gwintrob/0dda54b7017de7213e68 to your computer and use it in GitHub Desktop.
Multiple Nightmare Example
This file contains hidden or 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 urls = ['http://www.nytimes.com/', 'http://www.gnu.org/']; | |
function test() { | |
var nightmare1 = new Nightmare(); | |
var nightmare2 = new Nightmare(); | |
nightmare1 | |
.goto(urls[0]) | |
.evaluate(function () { | |
return document.documentElement.innerHTML; | |
}, function (res) { | |
console.log('evaluate: ' + urls[0]); | |
}) | |
.run(function (err, nightmare) { | |
console.log('run: ' + urls[0]); | |
}); | |
nightmare2 | |
.goto(urls[1]) | |
.evaluate(function () { | |
return document.documentElement.innerHTML; | |
}, function (res) { | |
console.log('evaluate: ' + urls[1]); | |
}) | |
.run(function (err, nightmare) { | |
console.log('run: ' + urls[1]); | |
}); | |
} | |
test(); |
This file contains hidden or 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
evaluate: http://www.gnu.org/ | |
run: http://www.gnu.org/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment