Created
May 8, 2013 15:43
-
-
Save moroya/5541338 to your computer and use it in GitHub Desktop.
phantomjs screenshot test
This file contains hidden or 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 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