Skip to content

Instantly share code, notes, and snippets.

@speters
Created December 19, 2013 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save speters/8039031 to your computer and use it in GitHub Desktop.
Save speters/8039031 to your computer and use it in GitHub Desktop.
Simple PhantomJS screenshot script
#!/usr/local/bin/phantomjs
var page = require('webpage').create();
var system = require('system');
var t, address;
if (system.args.length === 1) {
console.log('Usage: screenshot.js <some URL>');
phantom.exit();
}
address = system.args[1];
console.log(address);
page.open(address, function () {
t = Date.now();
page.render('screenshot_' + t + '.png');
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment