Make Selenium Easy

ElementClickInterceptedException – Element click intercepted – not clickable at point – Other element would receive the click

ElementClickInterceptedException – A very common exception in Selenium scripts and we try to solve this exception without knowing the cause of occurring it. People put wait or wait for element to be clickable or JavaScript which is very common.

Let’s replicate the same exception in a scenario :-

  1. Open Google.
  2. Type “Facebook” in search box.
  3. Click on Search button.
  4. Verify title of page.

Simple steps and below is code snippet:-

Output

It is not able to click on Search button. Let’s not understand the cause of occurring this and use our options.

Using some wait

Output is same again.

Using wait for element to be clickable

Output is same again.

Using JavaScript Click

It worked.

Using JavaScript click it worked but we bypassed the actual reason which may be a potential bug or a bad UX design. When we enter search keyword then google shows auto suggestions and HIDES THE SEARCH BUTTON. As per Official Selenium Doc – ElementClickInterceptedException Indicates that a click could not be properly executed because the target element was obscured in some way. This exception class extends ElementNotInteractableException class.

That is the reason Selenium Click was not able to click on element. Search button is overlapped by an auto suggestion option. Exception details also shows that which element will get click instead of search button. That is the reason neither wait worked nor wait for clickable. JavaScript works at DOM level directly so it was able to click.

It may be a bad design as it hides the search button. A person who is using google first time may not know that he can use Enter key or click on any suggestion from auto suggestion list to allow search. Keep Google aside and think about your application if this is the behavior.

There may be multiple reason behind this exception. Above is just one reason. You can write better handling code if you understand what is causing this instead of using JavaScript blindly and bypassing a potential bug.

Above scenario exception can be solved in below ways :-

  1. By sending Enter key to Search button instead of click.
  2. By clicking on a matching option from auto suggestions.

By sending Enter key to Search button instead of click

By clicking on a matching option from auto suggestions

You can download/clone above sample project from here.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyLearning

Find all Selenium related post here, all API manual and automation related posts here and find frequently asked Java Programs here.

Many other topics you can navigate through menu.

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

2 thoughts on “ElementClickInterceptedException – Element click intercepted – not clickable at point – Other element would receive the click

  1. Hey Amod, none of the above methods works. My execution does clicks on webelement as expected but my test cases failing with ElementClickIntercepted error. Can you please help ?

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.

ElementClickInterceptedException – Element click intercepted – not clickable at point – Other element would receive the click

by Amod Mahajan time to read: 5 min
2
%d bloggers like this: