I am trying to make an Instagram bot that gets all followers of a certain account, now I need to scroll to the bottom of the followers box to load all the followers but the box has no unique element at the end, I tried to scroll down using the down key but it says the element is interactable.
def get_followers():
# click on the followers link
driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/header/section/ul/li[2]/a').click()
time.sleep(1)
# the followers box
scroll_box = driver.find_element_by_xpath('/html/body/div[5]/div/div/div[2]/ul/div')
action = ActionChains(driver)
action.move_to_element(scroll_box).click().perform()
# scrolling to the end to load all element
while True:
scroll_box.send_keys(Keys.ARROW_DOWN)
get_followers()
Is there a more sufficient way to scroll through an element. Thanks in Advance.
question from:https://stackoverflow.com/questions/65869766/selenium-scrolling-through-a-dynamic-div-that-change-while-scrolling