Know which element intercepted a click

13 views
Skip to first unread message

François Guillot

unread,
Feb 24, 2020, 8:09:58 AM2/24/20
to Geb User Mailing List
Hi

I stumbled upon this problem several time.
I select a Navigator and want to click on it.
But it's actually another element that receives the click.
This can happen because Selenium clicks at the middle of the singleElement represented by this Navigator.
And it could be that something else is displayed at that exact coordinates.

It works on my machine, but doesn't on others with a different screen resolution (or when I manually play around with my browser test window size, because I'm moving it to another screen for instance)
=> On my machine, I also have this 'other element', but it's not reaching the middle of the Navigator I want to click on, so I don't see the problem.
On another browser resolution, the center of the Navigator is obstructed by this other -clickable- element. And the resulting behavior is not the expected one, and hard to diagnose.

Is there a way to ensure that the element that received the click is the one we targeted ?
I'dl like to print a warning, or even throw when that happens, as it's clearly not by-design of the test author.


Thanks,

François

Marcin Erdmann

unread,
Feb 24, 2020, 3:17:42 PM2/24/20
to geb-...@googlegroups.com
With regards to another element receiving a click - I know that some drivers, i.e. chrome, raise an exception in that case, just google for "org.openqa.selenium.WebDriverException: Element is not clickable at point". But I don't know how reliable that is given you are using chrome as the driver as far as I can tell and you are not seeing that exception...

Other than that, I unfortunately don't have any advice. I don't know how you would automatically detect that an unintended element received a click. FWIW, it's probably more of a Selenium rather than Geb question, really.

--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/a641fb85-31e0-413f-98e2-b7b8cf569d74%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages