Skip to content

Instantly share code, notes, and snippets.

@yhsiang
Created December 3, 2013 08:24
Show Gist options
  • Save yhsiang/7765806 to your computer and use it in GitHub Desktop.
Save yhsiang/7765806 to your computer and use it in GitHub Desktop.
$ phantomjs phantom-angular-runner.js [url]
var system = require('system');
var url = system.args[1] || '';
var renderHtml = function(url, cb) {
var page = require('webpage').create();
page.settings.loadImages = false;
page.settings.localToRemoteUrlAccessEnabled = true;
page.onCallback = function() {
cb(page.content);
page.close();
};
page.onInitialized = function() {
page.evaluate(function() {
setTimeout(function() {
window.callPhantom();
}, 10000);
});
};
page.open(url);
};
if(url.length > 0) {
renderHtml(url, function(html) {
console.log(html);
phantom.exit();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment