Просматривая документацию casperjs, я не смог найти, где я могу увидеть console.log с клиентского javascript. Возможно ли это?
Выходная клиентская консоль с casper/phantomjs
Ответ 1
Я не уверен, чтобы полностью понять ваш вопрос, но вы можете сделать что-то вроде следующего:
var casper = require('casper').create({
logLevel: "debug"
});
casper.on('remote.message', function(message) {
this.echo(message);
});
casper.start('http://google.com/', function() {
this.evaluate(function sendLog(log) {
// you can access the log from page DOM
console.log('from the browser, I can tell you there are ' + log.length + ' entries in the log');
}, this.result.log);
});
casper.run();
Вывод:
$ casperjs log.js
from the browser, I can tell you there are 4 entries