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 ドキュメント