Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
PhantomJS - Take a screenshot of a webpage as seen in the browser.
var website = 'http://www.google.co.uk';
var filename = './google.jpg';
var page = require('webpage').create();
page.viewportSize = {
width: 1024,
height: 592
};
page.open(website, function(status) {
console.log("Status: " + status);
if (status === "success") {
page.render(filename);
}
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment