How to fix Can not click on a Element: ElementClickInterceptedException in Python Selenium?

Sometimes, we want to fix Can not click on a Element: ElementClickInterceptedException in Python Selenium.

In this article, we’ll look at how to fix Can not click on a Element: ElementClickInterceptedException in Python Selenium.

How to fix Can not click on a Element: ElementClickInterceptedException in Python Selenium?

To fix Can not click on a Element: ElementClickInterceptedException in Python Selenium, we can use move_to_element to move to the element we want to click on before we call click.

For instance, we write

element = driver.find_element_by_css('div[class*="loadingWhiteBox"]')
webdriver.ActionChains(driver).move_to_element(element).click(element ).perform()

to get the div with class loadingWhiteBox with find_element_by_css.

Then we use

webdriver.ActionChains(driver).move_to_element(element)

to move to the returned element.

Next, we call click with element and then perform to do the click on the element.

Conclusion

To fix Can not click on a Element: ElementClickInterceptedException in Python Selenium, we can use move_to_element to move to the element we want to click on before we call click.