Open In App
Related Articles

How to scroll down followers popup in Instagram ?

Improve Article
Save Article
Like Article

Here, in this article, we are going to discuss How to scroll down followers popup on Instagram Using Python. With the selenium, we will automate our browsers and performs automation on Instagram’s Social Website. Before going to practical implementation, we need to install the Selenium Library using the pip command.


pip install Selenium

Now, Let’s check whether our selenium is installed or not. If the below command did not give any error that means selenium is successfully installed.


import selenium




Now, Let’s discuss the approach to how we can perform scrolling down functionality. Using while loop, We will scroll down the followers pop-up window until our program reached till the last follower. First, we will automate the login process with our login id and password and then go to the GeeksforGeeks Instagram page. Click on the follower’s button and then perform the scrolling down operation on the popup window. 

  • First, we need to import the time module and all necessary classes or methods from the Selenium Library.
  • Installing Chrome Web Driver through which we will perform all tasks on Chrome Web Browser. Same as Chrome, we can install any other browsers such as Edge, IE, Firefox, and many more.
driver = webdriver.Chrome(ChromeDriverManager().install())

Using the above line, we do not require to have any physical driver present in our system. This line will automatically install the required chrome web driver using the web.

  • Open the Website using the driver object and get() method with the given URL.
  • WebDriverWait is also called Explicit Wait. Explicit Wait is code which defines to wait for a certain condition to occur before proceeding further. in this code, With the help of CSS_SELECTOR, we will find the username and password fields for login purpose.

username = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, “input[name=’username’]”)))

password = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, “input[name=’password’]”)))

  • Now, before putting the username and password in the selected field, first, clear the username and password fields using the clear() method. Then, Put the username and password value using send_keys() method.
  • Click on the Login button using CSS_SELECTOR.

button = WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.CSS_SELECTOR, “button[type=’submit’]”))).click()

  • We are done with Instagram Login. Now, We can open our target profile URL on which we will perform the scrolling.

Here, in this practical implementation, we are using geeksforgeeks followers pop up for scrolling.

  • Click on followers button using find_element_by_partial_link_text method.
  • Find the pop-up window element from a webpage using XPATH. On the pop-up window, we will use a while loop for performing the scrolling until the program gets reached to the last followers. That’s why we take our loop as TRUE always.
  • Finally, Once we are done with our task. We will use the quit() method for closing the resources.

Below is the full implementation:


import time
from selenium import webdriver
from import By
from selenium.webdriver.common.keys import Keys
from import WebDriverWait
from import ChromeDriverManager
from import expected_conditions as EC
from import EdgeChromiumDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
# open the webpage
# target username
username = WebDriverWait(
    driver, 10).until(EC.element_to_be_clickable(
        (By.CSS_SELECTOR, "input[name='username']")))
# target Password
password = WebDriverWait(
    driver, 10).until(EC.element_to_be_clickable(
        (By.CSS_SELECTOR, "input[name='password']")))
# enter username and password
# target the login button and click it
button = WebDriverWait(
    driver, 2).until(EC.element_to_be_clickable(
        (By.CSS_SELECTOR, "button[type='submit']"))).click()
pop_up_window = WebDriverWait(
    driver, 2).until(EC.element_to_be_clickable(
        (By.XPATH, "//div[@class='isgrP']")))
# Scroll till Followers list is there
while True:
        'arguments[0].scrollTop = arguments[0].scrollTop + arguments[0].offsetHeight;'


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 26 Mar, 2021
Like Article
Save Article
Similar Reads
Related Tutorials