Python 3.7 Help on Selenium-Element could not be scrolled into view

Viewed 33

I am getting this error:

"selenium.common.exceptions.ElementNotInteractableException: Message: Element could not be scrolled into view"

This is the code i am using:

driver.find_element_by_xpath('//*[@class="next"]').click()

This is from the inspector:

enter image description here

Can you please let me know how to click on "Next"?

Many thanks.

1 Answers

Looks like this element is located out of the initially visible screen when you open that page with Selenium.
Try scrolling it into the view and then clicking it with the following code:

from selenium.webdriver.common.action_chains import ActionChains

actions = ActionChains(driver)

pager = driver.find_element_by_xpath('//li[@class="next"]')
actions.move_to_element(pager).perform()
time.sleep(0.5)
pager.click()
Related