i'm using python selenium package and i'm trying to scroll a page to the bottom.. although, the site which i apply the selenium is dynamic (dynamic loading) which means it doesn't really scrolled to the bottom of the page.
after i read, and i find in the selenium documentation i was able to get that solution:
for i in range(25):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
time.sleep(0.5)
this is not good enough for me, because sometimes the page needs much more iterations, and sometimes much less for getting to the bottom of a page.
is there a get function so i can use if statement, something like:
for i in range(25):
if driver.current_position == driver.document_height:
break
driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
time.sleep(0.5)
so, when i get to the end of the document i won't wait for nothing and break the loop.
or maybe if i can check how many pixels i jumped and if it's zero i will break the loop