I have the following code in casper :
var casper = require('casper').create();
var LOGIN = 'username';
var PASS = 'password';
casper.start('https://www.site.com/', function() {
this.echo(this.getTitle());
this.capture('before.png');
this.fillSelectors('#login', {
'#login' : LOGIN,
'#password' : PASS
},true);
console.log('wait');
this.wait(10000, function(){
console.log("waited 10 seconds");
this.echo(this.getTitle());
this.thenOpen('http://google.com/', function {
this.echo('loading google');
});
});
});
casper.run();
Running it produces the correct output
title wait waited 10 seconds logged in title
However this section :
this.echo('loading google');
is never executed. What am I doing wrong??
take this part
this.thenOpen('http://google.com/', function {
this.echo('loading google');
});
out of the function and make a new function
casper.thenOpen('http://google.com/', function {
this.echo('loading google');
});