我有一个名为clickMore
:
function clickMore(max, i){
i = i || 0;
if ((max == null || i < max) && this.visible(moreButton)) { // synchronous
// asynchronous steps...
this.thenClick(moreButton); // sometimes the click is not properly dispatched
this.echo('click');
this.waitUntilVisible(loadingButton);
this.waitUntilVisible(moreButton, null, function onTimeout(){
// only placeholder so that the script doesn't "die" here if the end is reached
});
this.then(function(){
//this.capture("business_"+i+".png"); //captures a screenshot of the page
clickMore.call(this, max, i+1); // recursion
});
}
}
我想在这里从 spooky 调用该函数:
spooky.then(function(){
clickMore.call(spooky);
})
我查看了 Spooky 文档,知道我可能需要使用函数元组,但不确定如何实现。我该怎么做呢?
更新:
尝试使用 SpookyJS 文档中的函数元组,但没有成功:
spooky.then([{
clickMore: clickMore
}, function(){
clickMore.call(spooky);
}]);