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:
JavaScript
x
2
1
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
2
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
JavaScript
1
11
11
1
2
from selenium.webdriver.support.ui import WebDriverWait
3
..
4
# after click follower link, wait until dialog appear
5
WebDriverWait(driver, 10).until(lambda d: d.find_element_by_css_selector('div[role="dialog"]'))
6
# now scroll
7
driver.execute_script('''
8
var fDialog = document.querySelector('div[role="dialog"] .isgrP');
9
fDialog.scrollTop = fDialog.scrollHeight
10
''')
11