Skip to content

Instantly share code, notes, and snippets.

@hassansin
Created July 31, 2015 13:51
Show Gist options
  • Save hassansin/9a5cddbd96190f767a66 to your computer and use it in GitHub Desktop.
Save hassansin/9a5cddbd96190f767a66 to your computer and use it in GitHub Desktop.
CasperJS onComplete called infinitely when exitOnError is false.
var casper = require('casper').create({
viewportSize: {
width: 1024,
height: 768
},
pageSettings: {
webSecurityEnabled: false
},
exitOnError: false,
waitTimeout: 70000
});
casper.on('error',function(msg, trace){
casper.bypass(casper.steps.length);
casper.thenOpen('http://yahoo.fr/', function() {
this.echo("Now I'm in your yahoo.")
});
casper.run(function(){
console.log('onComplete 2')
});
});
casper.start('http://google.fr/');
casper.then(function(){
throw new Error('dummy error');
});
casper.run(function(){
console.log('onComplete 1')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment