我在这里做错了什么?我想向下滚动一个页面,直到选择器消失。
Nightmare.action('scrollPage', function (done) {
this.evaluate_now(function () {
var hitRockBottom = false;
while (!hitRockBottom) {
// console.log("1");
// Scroll the page (not sure if this is the best way to do so...)
this.scrollTo(100000, 0);
// Check if we've hit the bottom
hitRockBottom = this.evaluate(function() {
// console.log("0");
return this.exists('selector') === null;
}); }
}, done)
})
我正在使用:
.goto("link")
.scrollPage()