Skip to content

Instantly share code, notes, and snippets.

@pilate
Created October 8, 2012 23:30
Show Gist options
  • Save pilate/3855613 to your computer and use it in GitHub Desktop.
Save pilate/3855613 to your computer and use it in GitHub Desktop.
var system = require('system');
// Check argument count
if (system.args.length === 2) {
var url = system.args[1];
}
else {
// Quit without correct arguments
console.log("URL Parameter Required.");
phantom.exit();
}
// Create new WebPage object for browsing
var page = new WebPage();
// Callback for page onload
page.onLoadFinished = function (msg) {
// Take a screenshot and exit
page.render("page.png");
phantom.exit();
}
// Browse to url
page.open(url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment