Created
May 20, 2013 22:51
-
-
Save TerasawaShuhei/5616224 to your computer and use it in GitHub Desktop.
casperjs > capture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var screenshotUrl = 'http://example.com/' | |
var casper = require("casper").create({ | |
viewportSize: { | |
width: 1280, | |
height: 1280 | |
} | |
}); | |
if (casper.cli.args.length < 1) { | |
casper | |
.echo("Usage: $ casperjs capture.js http://example.com") | |
.exit(1) | |
; | |
} else { | |
screenshotUrl = casper.cli.args[0]; | |
} | |
casper.start(screenshotUrl, function() { | |
this.capture('capture.png', { | |
top: 0, | |
left: 0, | |
width: 1280, | |
height: 1280 | |
}); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment