Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to fix element is not clickable at point error

How to fix element is not clickable at point error

I doubt there is an automation engineer that didn’t had Flaky Tests Caused by “element is not clickable at point “, ” other Element will receive the click”…. For me in every single project I’ve worked on it happened to see it … I know it’s a weird feeling , feels like is hunting me.

You might expect to give you an official solution for this , but well… I’m not going to , I will try to give you some workarounds that  worked for me , but you need to apply the solutions based on your situation.

Scroll to the top or bottom of the page

I know this is a very isolated case as your locator has to be in the top or bottom of the page but sometimes you might get “element is not clickable at point” around header of the page and that usually happens when ‘onscroll’ you have a sticky header.

JavascriptExecutor executor = (JavascriptExecutor)driver;

executor.executeScript("scroll(250, 0)"); // if the element is on top.

executor.executeScript("scroll(0, 250)"); // if the element is on bottom.

Ruby:

page.evaluate_script("scroll(250, 0")
By using Actions:

In one of my projects I managed to get read of the flaky tests caused by “element not clickable at point” sending : return key to the locator rather than clicking on it.

WebElement.sendKeys(Keys.RETURN);
Java
element = find('locator)
element.native.send_keys(:return)
ruby
Scroll into view

Scrolling into view might also help :

JavascriptExecutor executor = (JavascriptExecutor)driver;

executor.executeScript("arguments[0].scrollIntoView()", Webelement); 
Java
 page.execute_script("$('#{element}').get(0).scrollIntoView();")
ruby
Scroll to element

I usually prefer to scroll to element using the following method:

element = element.root_element if element.respond_to?(:root_element)
      Capybara.evaluate_script 
scroll to
Replace click action using “\n”

Some people manage to fix “element is not clickable at point” with a new line code in the send keys statement : send_keys(‘\n’) , this is pretty much like a return key(enter) so , you might be able to fix it using KEYS.return .

Hope one of the solutions above will help you solve this error , if you have any issues with this pieces of code please do let me know.

Thanks !

The post How to fix element is not clickable at point error appeared first on Testingrepository - Talking about selenium , and our passion.



This post first appeared on Testing Repository - Creating Testing, please read the originial post: here

Share the post

How to fix element is not clickable at point error

×

Subscribe to Testing Repository - Creating Testing

Get updates delivered right to your inbox!

Thank you for your subscription

×