Skip to content

Instantly share code, notes, and snippets.

@kimh
Last active August 29, 2015 14:14
Show Gist options
  • Select an option

  • Save kimh/73be57b27b48252cbc05 to your computer and use it in GitHub Desktop.

Select an option

Save kimh/73be57b27b48252cbc05 to your computer and use it in GitHub Desktop.
Casper.js cheetsheet

Dump html to console

this.debugHTML();

Capture screen shot

this.capture("shot.png");

Bind on resource events to debug

casper.on('resource.received', function(resource) {
    this.echo('Url: ' + resource.url);
});

casper.on("resource.error", function(resourceError){
    this.echo('Unable to load resource (#' + resourceError.id + 'URL:' + resourceError.url + ')');
    this.echo('Error code: ' + resourceError.errorCode + '. Description: ' + resourceError.errorString);
});

Ignore ssl certificate error

casper.js --ignore-ssl-errors=true your_test.js

Enable debug mode

casper.js --debug=true your_test.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment