SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

Misclicks on popup menu elements with native events #4217

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 4217

We have an application with navigation popup menu. It's a link and when user clicks
on it, ul with a set of li elements with links inside is displayed.

With enabled native events, I randomly get misclicks for these links. While playing
around, it looks like that during popup menu is being animated as popup, WebDriver
determines necessary link position but when it sends click event to it, this link's
position has already changed so WebDriver actually clicks on other element.

This happens 3 out of 5 times for me.

I've attached simple script to reproduce the problem.

As a workaround, I wait until all links in popup menu is displayed and then proceed
with clicking.

Expected output is:
❯ ruby context_menu_links.rb
Clicked Assembly and we're on page Assembly
Clicked Annotation and we're on page Annotation
Clicked Signature and we're on page GroupDocs Signature Envelopes
Clicked Comparison and we're on page Document Comparison
Clicked Viewer and we're on page Document Viewer

Actual output can look like this (depending on link WebDriver tried to click):
❯ ruby context_menu_links.rb
Clicked Assembly and we're on page Assembly
Clicked Annotation and we're on page Annotation
Clicked Signature and we're on page GroupDocs Signature Envelopes
Clicked Comparison and we're on page Document Comparison
Clicked Viewer and we're on page Document Comparison

Selenium version: 2.24.1
OS: Gentoo Linux x64, Windows 7 64-bit
Browser: Firefox
Browser version: 13.0.1

Reported by p0deje on 2012-07-09 04:14:17


lukeis commented 8 years ago
It's working as intended. When you use native events, selenium determines the position
and size of an element and sends a mouse event to the position that corresponds to
the center of this element. Whatever element is in this position in the moment of the
click -- that element will receive the event.

> As a workaround, I wait until all links in popup menu is displayed and then proceed
with clicking.

That's exactly what you have to do. Or you can wait until element position/size stops
changing.

Reported by barancev on 2012-07-11 13:15:10

lukeis commented 8 years ago
Thanks for looking into this!

Reported by p0deje on 2012-07-11 13:16:28

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 18:15:46