Scroll down Followers/Following List in the Instagram Box Scroll down Followers/Following List in the Instagram Box selenium selenium

Scroll down Followers/Following List in the Instagram Box


you can try execute_script() and change .isgrP if different class

...from selenium.webdriver.support.ui import WebDriverWait .....# after click follower link, wait until dialog appearWebDriverWait(driver, 10).until(lambda d: d.find_element_by_css_selector('div[role="dialog"]'))# now scrolldriver.execute_script('''    var fDialog = document.querySelector('div[role="dialog"] .isgrP');    fDialog.scrollTop = fDialog.scrollHeight''')


This method works perfectly for my situation. Don't change the sleep times within the loop please. They allow reload of followers/following within the dialogue box without having to scroll back up.

    FList = driver.find_element_by_css_selector('div[role=\'dialog\'] ul')numberOfFollowersInList = len(FList.find_elements_by_css_selector('li'))FList.click()actionChain = webdriver.ActionChains(driver)time.sleep(random.randint(2,4))while (numberOfFollowersInList < max):    actionChain.key_down(Keys.SPACE).key_up(Keys.SPACE).perform()            numberOfFollowersInList = len(FList.find_elements_by_css_selector('li'))    time.sleep(0.4)    print(numberOfFollowersInList)    actionChain.key_down(Keys.SPACE).key_up(Keys.SPACE).perform()                time.sleep(1)


You can test the following method. I tested and it works.

    """Scroll a specific element one or more times with small delay between    them."""    while times > 0:        self.driver.execute_script(            'arguments[0].scrollTop = arguments[0].scrollHeight',            element        )        time.sleep(.2)        times -= 1