'Selenium scroll function is not working on instagram pop-up

I want to use selenium to scroll the pop up that appear when i click on the list with who liked the photo.

I tried to search for the XPath of the element, i found this:

fBody =  WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.XPATH, "//div[@class='             qF0y9          Igw0E     IwRSH      eGOV_        vwCYk                                                                            i0EQd                                   ']")))

I tried with this class to

fBody =  WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.XPATH, "//div[@class=_1XyCr  ']")))

And the scroll down script:

driver.execute_script('arguments[0].scrollTop = arguments[0].scrollTop + arguments[0].offsetHeight;', fBody)
    
sleep(1)

The full code:

WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.XPATH, '//a[contains(@href,"liked_by")]'))).click()
sleep(10)

#DECLAR TABLOUL CE CONTINE BUTOANELE FOLLOWERS
fBody =  WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.XPATH, "//div[@class=_1XyCr  ']")))

driver.execute_script('arguments[0].scrollTop = arguments[0].scrollTop + arguments[0].offsetHeight;', fBody)
    
sleep(1)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source