简体   繁体   English

CasperJS - 继续执行步骤超时

[英]CasperJS - Continue on step timeout

As the title says, how can I make casperjs execute next step if previous step time-out? 正如标题所说,如果上一步超时,我如何让casperjs执行下一步?

My current code: 我目前的代码:

var casper =  require('casper').create({

    stepTimeout: 30000,
    verbose: true,
    onError: function(self, m) {   // Any "error" level message will be written
        console.log('FATAL:' + m); // on the console output and PhantomJS will
        self.exit();               // terminate
    },
});

I know there is an option onStepTimeout . 我知道有一个选项onStepTimeout

A function to be executed when a step function execution time exceeds the value of the stepTimeout option, if any has been set. 当步骤函数执行时间超过stepTimeout选项的值(如果已设置)时要执行的函数。

By default, on timeout the script will exit displaying an error, except in test environment where it will just add a failure to the suite results. 默认情况下,在超时时,脚本将退出显示错误,但在测试环境中 ,它只会向套件结果添加失败。

Or in other words, how can I enter the "test environment"? 或者换句话说,我怎样才能进入“测试环境”? Can't find anything related to environment. 找不到任何与环境有关的东西。

Any help would be appreciated. 任何帮助,将不胜感激。

Thanks in advance. 提前致谢。

oh, I think I'm just stupid............... 哦,我觉得我只是傻...............

var casper =  require('casper').create({

    stepTimeout: 30000,
    verbose: true,
    onError: function(self, m) {   // Any "error" level message will be written
        console.log('FATAL:' + m); // on the console output and PhantomJS will
        self.exit();               // terminate
    },
    onStepTimeout(self,m){
       console.log('timeout: step' + m);
    }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM