Solving The Message: element click intercepted Element is not clickable

element click intercepted Element is not clickable is an error which occurs in Selenium when the desired element isn’t clickable.

In this article we are going to explain why the error is popping up and show you how to solve the error and get rid of it for good.

Explaining the Error : Message: element click intercepted Element is not clickable

The error can happen to anyone trying to use Selenium to click on an element that isn’t clickable, generally that’s happening because of the exterior intervention of an element, we will get to this in detail in the sections bellow.

Bellow is an extract of the error message. Make sure your error message is similar to this.

                                                                       #
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: 
....
 <label translate-attr="{title: 'fulfillment.documentAction.createNew.modal.documentType.document.title'}" translate-values="{documentName: documentType.name}" for="documentType-0" translate="ASN - DSD" tabindex="0" title="Select ASN - DSD document type">...</label>
  (Session info: chrome=83.0.4103.116)
                                                                       #

Bellow is a great tested solution hat I have tried and has worked for me.

Solution : use execute_script()

If you read the error message carefully you realize that the error implies that the element isn’t clickable since an element on the page obscures it.

We assume of course that you are using the correct xpath or selector.

The best solution in this situation is to use execute_script() instead.

This is how to use it with an Xpath.

                                                                       #
driver.execute_script("arguments[0].click();", WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//label[@for='documentType-0']"))))
                                                                       #

This is how to use it with a CSS_SELECTOR.

driver.execute_script("arguments[0].click();", WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "label[for='documentType-0']"))))

I hope this solution has been enough to solve your problem, if not try the solution bellow.

I hope this guide solved your problem, thank you for reading.

Summing-up

Here we are at the end of the road, at the end of this article, if you solved this error congrats, this was a confusing error for me the first time I encountered it.

Make sure to keep coding and keep learning, Python is my favourite programming language, it just needs some patience, cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/