How to scroll down with Phantomjs to load dynamic content
Posted 一起来学python
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了How to scroll down with Phantomjs to load dynamic content相关的知识,希望对你有一定的参考价值。
page.open(‘http://example.com/?q=houston‘, function () {
// Checks for bottom div and scrolls down from time to time
window.setInterval(function() {
// Checks if there is a div with class=".has-more-items"
// (not sure if this is the best way of doing it)
var count = page.content.match(/class=".has-more-items"/g);
if(count === null) { // Didn‘t find
page.evaluate(function() {
// Scrolls to the bottom of page
window.document.body.scrollTop = document.body.scrollHeight;
});
}
else { // Found
// Do what you want
...
phantom.exit();
}
}, 500); // Number of milliseconds to wait between scrolls
});
以上是关于How to scroll down with Phantomjs to load dynamic content的主要内容,如果未能解决你的问题,请参考以下文章
css 到顶部按钮w / FA - https://paulund.co.uk/how-to-create-an-animated-scroll-to-top-with-jquery
How to Reset VW Steering Assist 1S1909144P with OBDSTAR X300 DP
L451 How to Cool down After Exercise