How to fix element is not clickable at point error


650
650 points
element is not clickable at point
element is not clickable at point

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 <<-EOS function() { var element = document.evaluate('#{element.path}', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; window.scrollTo(0, element.getBoundingClientRect().top + pageYOffset - 200); }(); EOS
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 !


Like it? Share with your friends!

650
650 points

What's Your Reaction?

cute cute
0
cute
scary scary
0
scary
wtf wtf
0
wtf
geek geek
0
geek
WIN WIN
0
WIN
Love Love
0
Love
OMG OMG
0
OMG
Angry Angry
0
Angry
Lol Lol
0
Lol
Test engineer

0 Comments

Your email address will not be published. Required fields are marked *

Choose A Format
Trivia quiz
Story