-
-
Save tavinus/ef4363875cf118d46e21ff82b7ba2b5a to your computer and use it in GitHub Desktop.
grab html source in casperjs or phantomjs
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
//phantomjs | |
var page = require('webpage').create(); | |
var url = 'http://instagram.com/'; | |
page.open(url, function (status) { | |
var js = page.evaluate(function () { | |
return document; | |
}); | |
console.log(js.all[0].outerHTML); | |
phantom.exit(); | |
}); | |
//casperjs | |
var casper = require('casper').create(); | |
var url = 'http://instagram.com/'; | |
casper.start(url, function() { | |
var js = this.evaluate(function() { | |
return document; | |
}); | |
this.echo(js.all[0].outerHTML); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment