Skip to content

Instantly share code, notes, and snippets.

@rosschapman
Created May 15, 2012 22:23
Show Gist options
  • Save rosschapman/2705595 to your computer and use it in GitHub Desktop.
Save rosschapman/2705595 to your computer and use it in GitHub Desktop.
Casper multi-page 404 tester
/*
* 404 Checker
*
*/
var casper = require('casper').create({
loadImages: false,
javascriptEnabled: false,
loadPlugins: false,
verbose: true,
logLevel: 'debug'
});
casper.on('resource.received', function(resource) {
if(resource.status === 404) {
this.echo(resource.url + ' ' + resource.status);
}
});
var links = [
'http://www.example.com/a',
'http://www.example.com/b',
'http://www.example.com/c',
'http://www.example.com/d',
'http://www.example.com/e',
'http://www.example.com/f',
'http://www.example.com/g',
];
casper.start().each(links, function(self, link) {
self.thenOpen(link, function() {
this.echo(link + ' try load');
});
});
casper.run(function(self) {
this.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment