Skip to content

Instantly share code, notes, and snippets.

@moroya
Created May 8, 2013 15:43
Show Gist options
  • Save moroya/5541338 to your computer and use it in GitHub Desktop.
Save moroya/5541338 to your computer and use it in GitHub Desktop.
phantomjs screenshot test
var page = require('webpage').create();
var system = require('system');
// 引数を引っ張る
var address = system.args[1];
var output = system.args[2];
var delay = Number(system.args[3]);
// ビューポートのサイズ
page.viewportSize = {
width: 1280,
height: 720
};
// ページを開く
page.open(address, function (status) {
if(status === 'success') {
window.setTimeout(function () {
page.render(output);
phantom.exit();
}, delay);
} else {
console.log('error!');
phantom.exit();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment