console.log doesn't work in CasperJS' evaluate with setTimeout

后端 未结 4 679
Happy的楠姐
Happy的楠姐 2020-12-01 10:16

Why when I use console.log in evaluate, it works:

casper.then(function() {
  this.evaluate( function() {
    console.log(\'hello\')         


        
4条回答
  •  眼角桃花
    2020-12-01 11:17

    @NiKo's answer is critical.

    I would also suggest adding the following, since if there's an error, you might not even make it far enough to print out a console.log() msg, and instead end up with silence.

    casper.on( 'page.error', function (msg, trace) {
        this.echo( 'Error: ' + msg, 'ERROR' );
    });
    

提交回复
热议问题