Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
casperjs : screenshot
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