'how to scroll a local div element with selenium

I am trying to scroll through a local div element using driver.find_element_by_xpath(element).send_keys(Keys.PAGE_DOWN)

the problem is that element is not an element that accepts key input, so the code throws an selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable

i could rather use pyautogui to simulate mouse and keyboard functions

pyautogui.moveTo(663,680)
pyautogui.click(663,680)

pyautogui.scroll(-200)
time.sleep(2)

but i would like to keep the code inside of the browser

any solution?



Solution 1:[1]

driver.execute_script("arguments[0].scrollIntoView(true)", element)

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Freddy Mcloughlan