I am running several test cases using Selenium Grid. I am using the latest driver and selenium packages.
Some time the script is running fine and some time I get the below error only on IE.
I am not getting this issue every time, but often.
Unexpected error launching Internet Explorer.
IELaunchURL() returned HRESULT 80070005 ('Access is denied.') for URL 'http:// localhost:13879/'
When I tried the solution provided below, it's say I need to do some changes to Windows Registry which is not possible in my enterprise.
https://code.google.com/p/selenium/issues/detail?id=7045
There are several such questions in SO and none has an response.
EDIT:
Due to company policies, I am not allowed to enable Protected Mode in all zones. So I have already have the below code for avoid protected mode issues.
ieCapabilities.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true
);
The only fix I have found is to sync up the protected flags. The capabilities flag set doesn't work in all cases. I'm not sure why it doesn't ignore consistently, but my guess is that IE keeps changing implementation as they release updates and the flag isn't consistent with the updates.
The security issue is with IEDriver accessing and controlling the browser which indicates to microsoft an "unknown" process is "possessing" the browser. The registry entries would be related to configuring the IEDriver as a secured process to control IE. I'm not sure of all those specific registry parts that IE utilizes, but you will probably find them on some IE specific registry site.
Even with the registry fixes if the protected flags are different IEDriver then gets confused and may lose the window completely and throw a window not found exception after launching it. I would really recommend trying to get someone to enable all the protected mode checkboxes for all 4 items in the security settings. The other part is that IE will sometimes launch and tell you that you don't have the "recommended" settings and would you like to use the "recommended" settings. You would need to click no and don't ask me again option.
After all of the above, as soon as you update IE you have to redo it again anyway, so whoever is in control of your environment needs to be on board with this if you want to use IE.
This worked for me without changing the security settings in IE, as my company did not allow it.
Open the Registry Editor, find the HKEY_CURRENT_USER\Software\Microsoft\Internet
Explorer\Main folder and new a REG_DWORD (32-bit) value name as TabProcGrowth, set the value as decimal 0.
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.
Run your webdriver with the below code
caps = DesiredCapabilities.INTERNETEXPLORER
caps['ensureCleanSession'] = True
caps['ignoreProtectedModeSettings'] = True
caps['forceCreateProcessApi'] = True
caps['ensureCleanSession'] = True
caps['ignoreZoomSetting'] = True
caps['INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS'] = True
driver = webdriver.Ie(capabilities=caps)
This will fix your error
It seems that the IEDriverServer very often does not capture the reference to the new IE process that gets spawned per tab when you open a new instance of IE. To work around this, we found that changing the TabProcGrowth setting in the registry to 0 makes it run IE as a single process in 64bit. The only other change that is needed it you need to use the 64bit version of the IEDriverServer. This resolves the issue of launching and makes the below stmt work well.
ieCapabilities.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true
);