Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Native clicks do not work properly in Internet Explorer #4403

Closed
lukeis opened this issue Mar 4, 2016 · 29 comments
Closed

Native clicks do not work properly in Internet Explorer #4403

lukeis opened this issue Mar 4, 2016 · 29 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 4403

Sometimes click does not work in IE with enabled native events. Consider the following
code:

System.setProperty("webdriver.ie.driver", "<path_to_iedriverserver>");
DesiredCapabilities d = DesiredCapabilities.internetExplorer();
//d.setCapability("nativeEvents", false);
webdriver = new InternetExplorerDriver(d);
webdriver.get("http://google.co.uk");
webdriver.findElement(By.linkText("Images")).click();
webdriver.findElement(By.linkText("Search")).click();

This script usually clicks "Images" link successfully, but in some cases it fails to
click "Search" afterwards. It is not a synchronization issue, the same stuff happens
when there is a, say, Thread.sleep() between the clicks. Moreover, if script is stopped
at the breakpoint after this code and user tries to click links manually, it does not
work either, but URLs keep flashing in the IE status bar as if some click event was
not completely handled. When IEDriverServer.exe process is killed, this browser window
becomes responsive again. 

Interestingly, if d.setCapability("nativeEvents", false) is uncommented, everything
works as expected.

Selenium version: 2.25.0
OS: WinXP
Browser: IE 8, IEDriverServer 2.25.3 (x32), browser mode = IE8, document mode = IE8
Standards

Reported by nebehr.gudahtt on 2012-08-13 08:26:21

@lukeis lukeis closed this as completed Mar 4, 2016
@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2012-08-14 10:50:52

  • Labels added: Component-WebDriver, Browser-IE

@lukeis lukeis changed the title placeholder empty issue Native clicks do not work properly in Internet Explorer Mar 4, 2016
@lukeis lukeis self-assigned this Mar 4, 2016
@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Wanted to say that this is also confirmed on the RemoteWebDriver, connecting to a node
running IEDriverServer 2.25.2 (and selenium server standalone 2.25).

The server node is running IE9 on Windows7.
It is actually the IE8 image downloaded from http://www.microsoft.com/en-us/download/details.aspx?id=11575
upgraded to IE9.

Also somewhat related, running with native events I get near 100% CPU utilization from
the IExplore process, and the tests almost choke.

Switching off "nativeEvents" on the capabilities resolves both issues (simulating click
and performance). Big thanks for the workaround from the issue opener.

Reported by amitayd on 2012-11-11 19:44:52

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I have native events working for iedriverserver 2.25.2, but broken for 2.26.2.0.
I am using IE9.

Reported by jan.c.kester on 2012-11-14 14:55:07

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2012-11-14 15:22:03

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Same issues, exactly as described, for IE10 also.
IEDriverServer 2.33.0.0

Reported by mykey2005 on 2013-05-31 12:06:13

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I too face this issue. IE Webdriver is now able to switch to iframe but click actions
are not working properly , always seeing flickering between page navigations.

IEDriverVersion : 2.33.0
IE 9.0
WebDriver:2.25.0

Please find the steps to reproduce this issue:
1.Navigate to http://digitalmagazine.autosport.com/
2.Click on "pay with paypal" button. This will popup a iframe window.
3.Try to navigate to iframe (WebElement frame = Grid.driver().findElementByName("PPDGFrame");Grid.driver().switchTo().frame(frame);
4.Click on the submit button.

Actual result:
Click action not working properly. Works sometimes but not always.


Reported by manavalangopinath on 2013-06-28 09:58:40

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I also have the same issue using IEDriverServer 2.33. with IE9 on Windows 7.

I have tried the workaroud of setting nativeEvents=false, however this prevents a click
in a different location. Without the workaround I cannot manually click when I insert
a breakpoint.

Reported by emlloyd@outlook.com on 2013-07-12 14:56:51

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

This issue is somehow related to persistent events firing. Alternative workarounds are
to disable "enablePersistentHover" capability or enable "requireWindowFocus". Perhaps
the event firing thread gets orphaned or something, I am not entirely sure. Or perhaps
the thread should always be resumed with explicitly specified target?

I think there should be a way to toggle persistent hover events on and off at runtime.
In 95% cases there is no need for them anyway.

Reported by nebehr.gudahtt on 2013-08-12 08:59:43

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Am seeing this issue with 2.35.3, IE8, Windows 7.

Am in enterprise with overly-secured IE settings.  There may well be (can't confirm
but strongly suspect) interactions with Win7 UAC and Internet Zone security settings
(and there are dozens of those in several places... :-(  )

Haven't found the right registry settings for internet zone protected mode settings
that prevent 'all zones must be either enabled or disabled' exception from IEDriverServer
so must use :introduceInstabilityByIgnoringProtectedModeSettings  => true.  Still have
inconsistent results from one run to the next with some clicks coming and going between
runs.

May have things like UAC being altered by big brother while I'm logged on.  (definately
when I log off or reboot...)

:nativeEvents => false appears to do what is noted in #7.  fixes some clicks, breaks
others (especially with breakpoints in Rubymine)

have not tried :enablePersistentHover or :requireWindowFocus settings yet.   

An awful lot of interacting settings that can't be changed during runtime... makes
automation all the more interesting ;-) 

Sure wish my C++ was a lot better so I could help look into this...  
And I had some time to cobble up working html that actually demonstrated the issues...
(not excuses, just current reality...)


Reported by patrick@3qilabs.com on 2013-09-25 18:22:11

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

>Haven't found the right registry settings for internet zone protected mode settings
that prevent 'all zones must be either enabled or disabled' exception from IEDriverServer
so must use :introduceInstabilityByIgnoringProtectedModeSettings  => true.

Registry settings?  Are you unable to simply check the "Enable Protected Mode" setting
for all zones in the Internet Options dlg?  

Reported by jondavidnelson@comcast.net on 2013-09-27 13:54:03

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

jondavid,  am in corporate environment where user is not allowed (even with local admin
rights) to change enable protected mode in internet options dialog.  (But can change
the registry... go figure)

For each zone there are four places in the registry where the various settings can
be changed.  Only one actually seems to control the display in Internet Options.  Not
sure which ones IEDriverServer looks at.

Reported by patrick@3qilabs.com on 2013-09-28 01:02:37

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Funny thing about the IE driver, it's entirely open source, which means you can check
it all out for yourself. The checks for Protected Mode settings is in the BrowserFactory
class, in an aptly named method, ProtectedModeSettingsAreValid[1]. There is a comment
in that method that references a Microsoft MSDN article documenting the IE registry
settings[2]. Finally, the exact location is further specified in the BrowserFactory
header file[3]. However, you should understand and make clear to the corporate IT drones
that you're forced to do the Wrong Thing(TM) by their shortsighted, overly restrictive
policies[4], and I'll be happy to discuss it with them as well.

[1] https://code.google.com/p/selenium/source/browse/cpp/iedriver/BrowserFactory.cpp#842
[2]   http://support.microsoft.com/kb/182569
[3] https://code.google.com/p/selenium/source/browse/cpp/iedriver/BrowserFactory.h#42
[4] http://jimevansmusic.blogspot.com/2012/08/youre-doing-it-wrong-protected-mode-and.html

Reported by james.h.evans.jr on 2013-09-28 02:13:00

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

guys, let's not forget, this issue has nothing to do with protected mode settings, it
is about clicks ceasing to work at some point.

Reported by nebehr.gudahtt on 2013-09-28 08:37:34

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

And furthermore, let's not forget that Protected Mode settings set improperly can be
a cause of exactly what you're describing. By default in IE, native event clicks are
extremely susceptible to a number of quirks. More specifically, native events are susceptible
to window focus, and the browser zoom level not being set to 100%.

The "browser is unresponsive while stopped at a breakpoint" behavior is directly related
to the enablePersistentHover capability, and is expected (if not entirely intended
behavior). If it is disturbing to you, you should turn that capability off.

The method the IE driver uses for handling native events by default is less than ideal,
which is why alternatives like synthetic events ("nativeEvents = false") and using
the Windows SendInput API ("requireWindowFocus = true") are available. The defaults
were chosen with some care. Native events are preferred to synthetic ones, as they
have more proper fidelity of action. Use of SendInput requires the target window to
have focus, full stop. Given that one of the project's stated goals is that the user
explicitly should *not* be forced to have the browser window in the foreground, that
capability is disabled by default. These decisions have been extensively written[1]
about[2].

The problem you're describing is not global. The behavior you're describing does not
happen for every user nor for every website. I cannot reproduce the issue in my environment
with the code you've provided. Setting these capabilities at runtime is not likely
to happen anytime soon. If you have a patch to fix the underlying issue with the IE
driver, along with a consistently failing test case to add to the WebDriver test suite,
the development team (me!) will be happy to review it for inclusion.

[1] http://jimevansmusic.blogspot.com/2012/06/whats-wrong-with-internet-explorer.html
[2] http://jimevansmusic.blogspot.com/2013/01/revisiting-native-events-in-ie-driver.html

Reported by james.h.evans.jr on 2013-09-28 11:25:34

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

James, 
Thanks for the links. I will explore the code as soon as I can.  And many thanks for
the explanations in #12 and #14.  I'll keep trying and let you know what I discover
if anything.

I just got put on a major new automation project with the usual unachievable deadlines
so have even less than no time to cobble up a page that exhibits the behavior that
I can legally send you...

Doncha just love big corps and big govt?

And thanks for your good work.  IEDriverServer has stabilized and grown very well in
the last year.  I don't envy your having to deal with MS and IE vagaries over at least
three versions...

Reported by patrick@3qilabs.com on 2013-09-30 18:07:01

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Is there anything we can do in Selenium to resolve this issue?

Reported by barancev on 2014-01-02 19:28:06

  • Status changed: NeedsClarification
  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hello I am testing Selenium web driver to see if I can implement it in my project/s.

I came across this issue.

What I can tell is the this issue happens to me when I try to find the button/s with
XPath, but if I create a CssClass for the button and find it by CssClass, the Click
works, the problem with that approach is that I would need a CssClass for each button
in a page. That is something I am trying to avoid.

I am working with C# and using the FindsByAttribute class to find my IWebControls.

I hope this helps in some way.

Regards,

José

Reported by JoseMaria.Pol on 2014-01-20 14:27:37

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Same is happening with me and the driver is running properly if the browser window is
active.

Reported by mayank3435 on 2014-03-11 13:34:47

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

This issue that I was having was that the first click on a link would work, but not
any following clicks. 

Solution:
I switched my link clicks to sendKeys("\n") and this solved my problem.  I then had
to switch any checkbox or radio button to sendKeys(" ") and true input buttons to sendKeys(Keys.RETURN).

Hope this helps!!
Jack

Reported by jackvonduhn on 2014-05-01 17:14:48

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Closing the issue as non-actionable. Feel free to ask for reopening if you think that
we can do something to improve the current behavior.

Reported by barancev on 2014-07-04 00:10:16

  • Status changed: WontFix

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

The resolution of this critical bug is the reason why I don't particularly like this
project.

Reported by alexnospam123 on 2014-08-13 17:08:08

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

element.sendKeys(Keys.enter) works for click event on an element.
I am facing problems of unhandledAlertException with IE browser while its working fine
with chrome and firefox browsers.

Anyone can help??

Reported by abhinavjain11 on 2014-12-17 06:52:06

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

it is a pity - as this issue destructs CI for IE case (((

Reported by alexey.tatarnikov on 2015-01-23 12:14:09

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

barancev there IS a bug here.  I am currently battling with this issue to try and find
a workaround.

Local IE11 being driven by IEDriverServer 2.45.0.0

Have a simple link that doesnt respond to a click event. Even manual clicks (test script
paused after Selenium click) dont work.  href URL is shown flickering at bottom of
browser but nothing happens.  Killing IEDriverServer process fixes the issue - and
manual click responds.

If I can get time I'll try to dig deeper to find a root cause; but please, can we re-open
this bug as it is still there after being reported by the OP nearly 3 years ago.

Reported by mat@alexview.com on 2015-07-07 21:44:40

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Issues on this issue report are receiving no attention. The project's issue reporting
has moved to GitHub (https://github.com/SeleniumHQ/selenium/). As for the "flickering",
that's likely cause by so-called "persistent hovers," which can be turned off via a
capability.

Reported by james.h.evans.jr on 2015-07-07 21:52:03

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi,

I am facing this issue where in clicks on links,button,checkbox etc are not having
any effect. 
Currently I am clicking using Javascript which seems to be working fine as of now.

Thanks,
Sanam

Reported by sanamsmail on 2015-07-30 06:35:02

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Hi,
using C#:

I'm facing issues with 2.46.0 dlls for IE 11 browser. Clicks are not clicking properly
and flickering. I have tried Javascript click and Event Click as well. But for IE9
, no such issues.
Same code was working fine using 2.45.0 dlls for both IE9 and IE11. 

Reported by rameshnss on 2015-08-17 21:32:31

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I had one particular button that was not responding to clicks about 80% of the time
and using setCapability("nativeEvents", false) solved this issue for me but the same
exact problem appeared in a bunch of other places as a result.

Reported by locketine on 2015-08-18 00:20:02

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:16:00

  • Labels added: Restrict-AddIssueComment-Commit

@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant