Skip to content

Instantly share code, notes, and snippets.

@euperia
Created February 23, 2015 16:15
Show Gist options
  • Save euperia/5029442cdaf23432707f to your computer and use it in GitHub Desktop.
Save euperia/5029442cdaf23432707f to your computer and use it in GitHub Desktop.
Screengrab a website with phantom.js
/**
* Phantomgrab - take a screenshot of a webpage
*
* Run with:
* phantomjs --ssl-protocol=any --ignore-ssl-errors=true phantomgrab.js
*
*/
var page = require('webpage').create();
var url = 'https://www.google.com/';
var file = 'screenshot.png';
page.viewportSize = { width: 1280, height: 800 };
page.open(url, function() {
window.setTimeout(function() {
page.render(file);
phantom.exit();
}, 2000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment