Webdriver click and scroll to element python



If you use Default method like

from selenium.webdriver.common.action_chains import ActionChains element = driver.find_element_by_id("my-id") actions = ActionChains(driver) actions.move_to_element(element).perform()

Sometimes not working and ends with an error somthing like this:

Element cannot be scrolled into view

Message: move target out of bounds

Message: element click intercepted: Element is not clickable at point (1118, 2233)

Then you can try something like this..

driver.execute_script("arguments[0].scrollIntoView(true);", element) sleep(3) element.click

Or use javascript to remove or click element on the page.

self.driver.execute_script('arguments[0].click();', button_next) # driver click not working