浏览 casperjs 文档,我找不到在哪里可以从客户端 JavaScript 看到 console.log。这可能吗?
最佳答案
我不太确定完全理解您的问题,但您可以执行以下操作:
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
关于javascript - 使用 casper/phantomjs 输出客户端控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10745345/