I have been using the below function to scroll down a page for over 2 years now and on the 31st December 2019 it just stopped working, no errors, just stopped scrolling down.
I'm using Chrome version Version 79.0.3945.88 and ChromeDriver 2.36.540470. Any ideas or help is greatly appreciated.
def scrollToEndOfPage(self, driver):
try:
time.sleep(1)
# Get scroll height
last_height = driver.execute_script("return document.body.scrollHeight;")
while True:
# Scroll down to bottom
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
# Wait to load page
time.sleep(randint(2,4))
# Calculate new scroll height and compare with last scroll height
new_height = driver.execute_script("return document.body.scrollHeight;")
if new_height == last_height:
break
last_height = new_height
except Exception as e:
print(str(e))
Update: 1
I've run document.body.scrollHeight; on the website in question (internal site) and it displays the page height but when I try and execute driver.execute_script("return document.body.scrollHeight;") via a script, it hangs on this request and doesn't return anything and there are no errors.
https://www.morhipo.com/kampanya/alisveris. Chrome 79.0.3945.88. ChromeDriver 79.0.3945.36. MacOS - SersUpdate: 1. - llanato