1

Hope any of you already encountered this issue (or not if im just doing something wrong).

I have this code which should srcroll down until all the items has been loaded, however it does not seem to scroll.

# Get scroll height
        last_height = self.driver.execute_script("return document.body.scrollHeight")
        print('Done getting height', last_height);

        while True:
            # Scroll down to bottom
            self.driver.execute_script("window.scrollTo(0, document.body.scrollHeight)"; )

            # Wait to load page
            sleep(5)

            # Calculate new scroll height and compare with last scroll height
            new_height = self.driver.execute_script("return document.body.scrollHeight")
            print(new_height)
            if new_height == last_height:
                sleep(2)
                break
            last_height = new_height

I'm using Py v3.7 and the latest selenium version as of posting, no other dependency used.

Here is a screenshot of page, unfortunately i cannot share it since it has confidential information, i tried to check somethings on the page and I found out that if i click on a certain part of the page it does not let you scroll, maybe because this is a page from a sharepoint site?

screenshot of issue

I tried using the same code on duckduckgo website and it works fine, and I clicked on any of the duckduckgo website and it is scrollable too, seems like my hunch is correct?

CarlP
  • 171
  • 8
  • Which part exactly you are having issues with? running it in the loop or just scrolling down? – Equinox Sep 15 '20 at 12:20
  • Scrolling, it does not scroll at all. And the loop stops since my old and new height are same. – CarlP Sep 15 '20 at 13:04
  • do you have a specific url to test? – Sebastien D Sep 15 '20 at 14:19
  • unfortunately I cannot share since it has confidential information of the company, I've added screenshot to provide more information on why the scroll might not be working though. – CarlP Sep 15 '20 at 14:39

0 Answers0