Hi all,
I have a webpage with infinite scrolling. For this page, I need to scroll to bottom of the page. Following is the snippet of code I am trying to run:
page.open(webPageUrl, function (status) {
if (status !== 'success') {
console.log('FAIL to load the address. ');
}
setTimeout(function(){
page.evaluate(function() {
// Scrolls to the bottom of page
window.document.body.scrollTop = document.body.scrollHeight;
});
}, 10000);
});
Question
1. Is the above approach correct and should work in PhantomJS?
2. Is there a way to verify if the scroll is actually happening? I tried following to check this:
- I tried page.render before and after, both screenshots are same with no scrolling.
- I tried getting values of body.scrollHeight before and after the above code snippet. Both giving value of 300. Seems like page.viewportSize is also not working for me.
Any pointers would be a great help.
Thanks in advance!