Skip to content

Instantly share code, notes, and snippets.

@edysegura
Last active August 29, 2015 14:21
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 edysegura/a2c9324ca70bed5502d3 to your computer and use it in GitHub Desktop.
Save edysegura/a2c9324ca70bed5502d3 to your computer and use it in GitHub Desktop.
[JS] Take a snapshot with PhantomJS
var page = require('webpage').create();
page.open('http://edysegura.com', function () {
var title = page.evaluate(function () {
return document.title;
});
page.clipRect = { top: 0, left: 0, width: 600, height: 700 };
page.render(title + ".png");
phantom.exit();
});
//to run just do the command below
//# phantomjs screenshot.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment