javascript - With CasperJs, how to print log in the DOM environment? -
i new casperjs. have code , wondered how log messages 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 got info message 'value = 111'. not able message 'inside getlog' printed out on console. thx!
just add right after initialize casper
casper.on('remote.message', function(msg) { this.echo(msg); });
Comments
Post a Comment