Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@davidcraig
Last active March 31, 2017 07:56
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 davidcraig/bb11276e80ce16ee91f0735bc9cad26a to your computer and use it in GitHub Desktop.
Save davidcraig/bb11276e80ce16ee91f0735bc9cad26a to your computer and use it in GitHub Desktop.
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