I performed code below on a floating page like https://www.youtube.com/user/JFlaMusic/videos with python selenium chromedriver. But code was performed incorrectly.
I expected to go to the end of page, but last_height and new_height were same at first while condition loop. so break was performed.
why does this result occur?
last_height = self.driver.execute_script("return document.documentElement.scrollHeight")
print(last_height)
while True:
self.driver.execute_script("window.scrollTo(0, document.documentElement.scrollHeight);")
time.sleep(0.5)
new_height = self.driver.execute_script("return document.documentElement.scrollHeight")
print(new_height)
if new_height == last_height:
break
last_height = new_height