Created
October 14, 2016 19:28
-
-
Save eewee/ccdf2af7f6914fe702a02c727b318996 to your computer and use it in GitHub Desktop.
casperjs : screenshot
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 casper = require('casper').create(); | |
var utils = require('utils'); | |
var urls = [ | |
'http://www.eewee.fr/', | |
'http://www.eewee.fr/page/2/', | |
]; | |
var i = 0; | |
casper.start(); | |
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)'); | |
casper.each(urls, function(self, url){ | |
casper.thenOpen(url, function(){ | |
// Prendre une photo | |
this.viewport(1800, 1200); | |
this.capture('eewee_capture_'+i+'_all.jpg'); | |
this.viewport(1024, 768); | |
this.captureSelector('eewee_capture_'+i+'_1024x768.jpg', 'article'); | |
this.viewport(800, 600); | |
this.captureSelector('eewee_capture_'+i+'_800x600.jpg', 'article'); | |
this.viewport(400, 300); | |
this.captureSelector('eewee_capture_'+i+'_400x300.jpg', 'article'); | |
this.echo( this.status(true) ); | |
i++; | |
}); | |
// Scroll | |
this.scrollToBottom(); | |
}); | |
casper.run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment