I am using Selenium chromedriver and Python to scrape linkedin data. I am trying to auto scroll the linkedin connections page but it does not reach the end of the page or doesn't load the whole page. I am attaching the codes I am using. Could anyone point out where I am going wrong?
while True:
# Scroll down to bottom
browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
# Wait to load page
time.sleep(3)
# Calculate new scroll height and compare with last scroll height
new_height = browser.execute_script("return document.body.scrollHeight")
print('new height ' + str(new_height))
if new_height == last_height:
break
last_height=new_height
This code doesn't help in infinite scrolling and stops after it auto scrolls 1 time. Thanks in advance.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…