如何evaluate
在 CasperJS 中调试 javascript 函数(使用)?
是否有任何类似的东西alert()
可以在这里用于在需要时在命令行上打印值?
如何evaluate
在 CasperJS 中调试 javascript 函数(使用)?
是否有任何类似的东西alert()
可以在这里用于在需要时在命令行上打印值?
尝试这样的事情:
// add this to the top of the script
casper.on('remote.message', function(msg) {
this.echo(msg);
})
casper.thenEvaluate(function() {
// and then add this to the evaluate to print a value
console.log('Testing...');
})
要将其与 try-catch 一起使用,请使用以下命令:
casper.thenEvaluate(function() {
try {
throw "Some error...";
} catch(err) {
console.log(err);
}
})
来源:CasperJS 文档