Created
May 15, 2012 22:23
-
-
Save rosschapman/2705595 to your computer and use it in GitHub Desktop.
Casper multi-page 404 tester
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
/* | |
* 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