CasperJS - 继续执行步骤超时

时间:2013-03-22 01:21:38

标签: javascript casperjs

正如标题所说,如果上一步超时,如何让casperjs执行下一步呢?

我目前的代码:

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

  

步进功能执行时间超过时执行的功能   stepTimeout选项的值(如果已设置)。

     

默认情况下,在超时时脚本将退出并显示错误,   除了测试环境,它只会添加失败   套件结果。

或者换句话说,我怎样才能进入“测试环境”?找不到任何与环境有关的东西。

任何帮助将不胜感激。

提前致谢。

1 个答案:

答案 0 :(得分:3)

哦,我觉得我只是傻...............

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);
    }
});
相关问题