Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
working with casperjs and http status codes
var casper = require('casper').create({
httpStatusHandlers: {
404: function(self, resource) {
self.echo(resource.url + ' not found (404)');
},
500: function(self, resource) {
self.echo(resource.url + ' gave an error (500)');
}
},
verbose: true
});
casper.start('http://mywebsite/404', function() {
this.echo(this.result.status);
this.echo(this.currentHTTPStatus);
this.echo('We suppose this url return an HTTP 404');
});
casper.run(function() {
this.echo('Done.').exit();
});
@gabegomez014

This comment has been minimized.

Copy link

commented May 26, 2017

I know you made this 5 years ago, but I am currently using this for a project I am working on and this example was key in helping me understand how to use it. So with that being said, I can't stress a big enough THANK YOU!!!!!! Greatly appreciated 5 years down the road by at least one person

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.