How would I scroll in the following window on Instagram using Selenium and Python? I've tried everything I've found and none of them work.
Here's what I have to get me to the following window:
from selenium import webdriver
browser = webdriver.Firefox(executable_path = '/usr/local/bin/geckodriver')
browser.implicitly_wait(5)
browser.get('https://www.instagram.com/')
sleep(2)
username_input = browser.find_element_by_css_selector("input[name='username']")
password_input = browser.find_element_by_css_selector("input[name='password']")
username_input.send_keys("Enter Username Here")
password_input.send_keys("Enter Password Here")
login_button = browser.find_element_by_xpath("//button[@type='submit']")
login_button.click()
sleep(5)
browser.find_element_by_xpath('/html/body/div[1]/section/main/div/div/div/section/div/button').click()
sleep(2)
browser.find_element_by_css_selector('button.aOOlW:nth-child(2)').click()
browser.get('https://www.instagram.com/instagram/')
sleep(2)
browser.find_element_by_css_selector('li.Y8-fY:nth-child(3) > a:nth-child(1) > div:nth-child(1)').click()
sleep(2)
follower_number =int( driver.find_elements_by_xpath('//span [@class="g47SY "]')[2].text)
i=0
while(i<follower_number):
element = driver.find_elements_by_xpath("//div[@role='dialog']//ul//li")
driver.execute_script("arguments[0].scrollIntoView(true);",element[i])```