Reputation: 1108
I am new to CasperJs. I have this code and wondered how to get log messages from the getLog function.
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
});
function getLog() {
console.log('inside getLog');
return 111;
}
casper.start('http://google.fr/', function () {
this.log('page loaded', 'info');
});
casper.then(function() {
this.log('calling getLog', 'debug');
value = this.evaluate(getLog);
this.log('value = ' + value, 'info');
});
casper.run();
The function getLog() got called because I got info message 'value = 111'. I am not able to get the message 'inside getLog' printed out on console. Thx!
Upvotes: 1
Views: 296
Reputation: 3811
Just add this right after you initialize casper
casper.on('remote.message', function(msg) {
this.echo(msg);
});
Upvotes: 1