Created
July 21, 2013 08:03
-
-
Save PirosB3/6047877 to your computer and use it in GitHub Desktop.
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
page = require('webpage').create(), | |
system = require('system'); | |
var address = 'http://localhost/'; | |
var output = '/tmp/screen.png'; | |
page.clipRect = { top: 0, left: 0, width: 1280, height: 720 }; | |
page.open(address, function (status) { | |
if (status !== 'success') { | |
console.log('Unable to load the address!'); | |
phantom.exit(); | |
} else { | |
window.setTimeout(function () { | |
page.render(output); | |
phantom.exit(); | |
}, 200); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In realtà il setTimeout dovrebbe risolvere un bug di render che usa un altro thread e non è completamente sincrona quindi andrebbe solo prima della exit()
Vedi: http://stackoverflow.com/questions/15205538/where-are-screenshots-from-phantom-js-saved