0
我需要取消Facebook視頻頁面,但「加載更多按鈕」是在Ajax中。 所以我嘗試使用PhantomJS來點擊按鈕。Phantom JS加載更多元素
但是,我需要多次點擊按鈕。
所以這是我的代碼:
var page = require('webpage').create();
page.open("https://www.facebook.com/MisterVOnline/videos", function(status) {
if (status === "success") {
page.evaluate(function() {
while(document.querySelector(".uiMorePagerPrimary")){
document.querySelector(".uiMorePagerPrimary").click();
window.setTimeout(function() {
}, 5000);
}
});
window.setTimeout(function() {
//console.log(page.content);
page.render('facebook.jpeg');
phantom.exit();
}, 5000);
}
});
時沒有while循環,他做了一個很好的加載代碼不工作...
我希望有人能幫幫我!