2015-06-20 17 views

回答

2

onWaitTimeout的签名是:

onWaitTimeout(Integer timeout, Object details) 

这是可悲的是不正确记录。传递给函数的details对象包含代表选择器的selector属性。如果它是XPath选择器,那么您将需要获取path属性。

casper.options.onWaitTimeout = function(timeout, details) { 
    var selector = details.selector.type === 'xpath' ? 
      details.selector.path : details.selector; 
    this.echo("Wait timed out after " + timeout + " msec with selector: " + selector); 
}; 

请注意,此函数将捕获所有等待超时,如果您愿意,您将不得不退出脚本。

查看源代码总是一个好主意:1 & 2

相关问题