How can i scroll on pop up window in Instagram selenium

Viewed 418

I was scraping followers of specific username from Instagram using selenium. I was able to scroll on the main page using the following code.

driver.execute_script("window.scrollTo(0, 2000);")

but now the followers come up with pop up windows and i am unable to scroll in it. even i tried as follows.

followers_list = driver.find_element_by_class_name("isgrP")
followers_list.execute_script("window.scrollTo(0, 200);")

The screen shot from instagrm is as belows. pop up windows screen shot

1 Answers

Use the below code to scroll 5 times, you can increase or decrease counter as per your requirement.

fBody  = driver.find_element_by_xpath("//div[@class='isgrP']")
scroll = 0
while scroll < 5: # scroll 5 times
    driver.execute_script('arguments[0].scrollTop = arguments[0].scrollTop + arguments[0].offsetHeight;', fBody)
    sleep(2)
    scroll += 1
Related