Search code examples
javascriptseleniumfirefoxspotify

How to scroll page apart from window.scrollTo()


I've got a test assignment, which asks me to parse Spotify playlists for some info (artist, album, song name, and duration). I'm not allowed to use Spotify API. So far I've managed to retrieve the info required, but I've only first 100 records. JavaScript's window.scrollTo() for some reason doesn't work on open.spotify.com (just try it in your browser), and I can't find any other way to fully load the page. Here is Spotify playlist I'm working with, it contains 931 songs


Solution

  • Thanks to Ryano for providing an actual answer. Spotify pages can be scrolled down by firing

    document.getElementsByClassName('os-viewport')[1].scrollTo(0, document.getElementsByClassName('os-viewport')[1].scrollHeight)