Skip to content
Advertisement

How to avoid ElementClickInterceptedException when working with Selenium?

I use selenium with python and want to mark a checkbox by clicking on it. After having identified the <input> tag of the checkbox with selenium, I attempt to click on it with

checkbox.click()

However, it throws the ElementClickInterceptedException.

I identify the checkbox I want to click on through a loop. When I try to click on the checkbox outside of the loop (by manually running the code after it was identified and saved to a variable), I found two things:

  • All things equal, I still get the exception
  • When I click in the browser window once (that was opened with selenium) and then run checkbox.click(), it works as expected

Any ideas why and how I could attempt to slove this issue (i.e. being able to click on the checkbox within the loop)?

Thanks!

Advertisement

Answer

You either deal with the overlapping element or use javascript

driver.execute_script("arguments[0].click();", checkbox)
Advertisement