The following code using casper.js doesn’t output This is thenEvaluate string because Twitter.com disabled console.log (empty function):
var casper = require('casper').create({
verbose: false,
logLevel: 'debug'
});
casper.start("http://twitter.com");
casper.on('remote.message', function(msg) {
this.echo('remote message caught: ' + msg);
})
casper.thenEvaluate(function() {
console.log('This is thenEvaluate');
});
casper.run();
If I swapped the url to google.com or any other website, it works. My question is:
-
For website disabled
console.log, is there a way to re-enable it? -
If NO for #1, is there a way to do any kind of log at all within
evaluate()orthenEvaluate()function?
Thanks.
I found the answer here about Restoring console.log()