How does the registry entry HKEY_LOCAL_MACHINE\...\FEATURE_BFCACHE for InternetExplorerDriver solves the Internet Explorer 11 issue?
Asked Answered
S

1

5

So I am automating a web application in IE11 (Three cheers for government contracting!) and I am following the instructions on the Selenium Wiki to configure the thing because we have had a bunch of weird and wonky behavior. I am at this step here and well, it says that I have add a registry key to help maintain a connection to between the driver and the browser:

For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

But it doesn't really explain why? What goes wrong when you don't have this key added? The words "Maintain connection between an instance of IE and the webdriver" can mean a lot of different things.

The problems we are experiencing deal largely with Selenium Methods like .click() not working or not clicking on the page for those interesting in a point of reference. We are also having some weird scrolling issues where it fails a test when the element is juuuuust off-screen, which is weird because it should be reading the DOM, but I digress.

Spinozism answered 30/7, 2018 at 18:24 Comment(5)
I would suggest a couple of things, I worked in a testing environment for about 2 years of my professional career, one, the mshtml library of .Net is better for automating IE, but if you are going the straight Selenium route, I suggest using it's javascript injector for doing DOM things, using the javascript version of .click is much more reliable.Cholecyst
Yeah. We are going that route. I was just wondering if the registry key was possibly related to the .click instability? As I said, the wiki is pretty vague on what doing the registry actually solves.Spinozism
From my experience, the registry key setting had no affect on the reliablility of Selenium's .Click()Cholecyst
The registry entry disables a caching feature of IE called BFCache, which affects how pages are cached and loaded when using forward and backward navigation feature of the browser. When enabled, the COM objects on which the driver relies (yes, the very same objects used by the mshtml library) become “orphaned” if you navigate back or forward. There are other ways to increase the “reliability” of the driver’s click() method.Kriemhild
Oh cool!. Do you mind copy and paste that into an answer so I can give you credit for it? I want to give that StackOverflow karma to you! Also, any info you could elaborate on making the .click methods more reliable would be appreciated albeit not REALLY on topic.Spinozism
O
4

You saw it right. As per the documentation in the Required Configuration section of InternetExplorerDriver it is clearly mentioned:

For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates.

  • For 32-bit Windows installations, the key you must examine in the registry editor is:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. 
    
  • For 64-bit Windows installations, the key is:

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. 
    
  • Note The FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

A brief history

As per @JimEvans comments within the discussion IE11 exceptions with IEDriverServer: Unable to get browser:

  • On 16 December 2014, Microsoft released update KB3025390 via Windows Update as part of its normal "patch Tuesday" update cycle. For most users, this update is downloaded and installed without user interaction. This update breaks the IE driver when using it with IE11.

  • As part of this update, attempting to use the COM method IHTMLWindow2::execScript returns an "access denied" result. This renders the driver unable to execute JavaScript in the page bring browsed. However, given that large portions of driver functionality are implemented using JavaScript, this effectively renders the driver all but unusable with IE11.

  • There is no known workaround for this issue. At this time, the Microsoft IE driver implementation is still incomplete, lacking basic functionality required to make it usable, so it cannot be recommended. Uninstalling the update might restore IE driver functionality, but this is hardly ideal.

  • While the execScript method is marked as deprecated for IE11, the driver had heretofore been able to use that method successfully, and it was hoped that it would remain useful throughout the IE11 life cycle. We now know this not to be the case. Additionally, attempts to use the Microsoft-suggested replacement, eval, have been fruitless thus far.

  • The issue is currently being tracked in the Selenium issue tracker.

  • In this discussion @JimEvans further added a comment as:

The registry entry disables a caching feature of IE called BFCache, which affects how pages are cached and loaded when using forward and backward navigation feature of the browser. When enabled, the COM objects on which the driver relies (yes, the very same objects used by the mshtml library) become orphaned if you navigate back or forward. There are other ways to increase the “reliability” of the driver’s click() method.

Optometer answered 20/8, 2018 at 10:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.