Skip to content
Advertisement

Scroll down Followers/Following List in the Instagram Box

Hi :) I was looking for a solution to scroll down the following/followers list in the Instagram Box. The step I do are the following:

  • open an IG profile of the user A;
  • click on the button “followers”;
  • a box with a list of 12 followers appears in a IG box.

Once the followers list is shown up, when I scroll down using the line:

driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

I get that the page below the box scrolls down :(

How can scroll down the list in the followers box?

Thanks in advance :) Maria.

Advertisement

Answer

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 appear
WebDriverWait(driver, 10).until(lambda d: d.find_element_by_css_selector('div[role="dialog"]'))
# now scroll
driver.execute_script('''
    var fDialog = document.querySelector('div[role="dialog"] .isgrP');
    fDialog.scrollTop = fDialog.scrollHeight
''')
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement