I am doing a Web Scraping Project with Youtube. I need to automatically scroll to the bottom via Javascript. I am inputting the command in Google Chrome Inspect Console Terminal.
This link: https://stackoverflow.com/a/29971996/3326078 showed me to use this:
window.scrollTo(0, document.body.scrollHeight ||document.documentElement.scrollHeight);
Above works as expected.
However when I do,
for (var i = 0; i < 5; i++) {
setTimeout(window.scrollTo(0, document.body.scrollHeight
|| document.documentElement.scrollHeight),5)}
it doesn't repeat more than once. Can someone explain to me whether what I am trying to do is possible. Again, I am inputting this command in the Google Chrome Inspector Console.
Thanks!