2013-03-22 110 views
1

正如標題所說,如果上一步超時,如何讓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選項的 的值,如果任何已被設置爲被執行。

默認情況下,超時腳本將退出顯示錯誤, 除了測試環境它只會增加一個失敗的 套件結果。

換句話說,我該如何進入「測試環境」?找不到與環境有關的任何東西。

任何幫助,將不勝感激。

在此先感謝。

+2

我想你可以給你的自我回答打勾。 「測試環境」是指使用Tester模塊的casper:http://casperjs.readthedocs.org/en/latest/modules/tester.html –

回答

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); 
    } 
});