Selenium - NoSuchWindowException in IE 11
First of all, don't use
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
as you have already set Protected mode settings. For the issue you are seeing, it should be because of the missing registry settings that is added as a prerequisite for running tests in IE11:
https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration
The solution suggested by @David Kemp is not working for the ie 11 of windows 10 - 64 bit . I have added the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet explorer\Main\FeatureControl\FEATURE_BFCACHE
according to the steps mentioned For IE 11 only following https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration but after opening the https certificate page (url https://my-page:9443) it is unable to execute driver.navigate().to("javascript:document.getElementById('overridelink').click()");
throwing NoSuchWindowException
However same works fine for ie 11 of windows 7-64 bit and able to execute the scripts .
The work around to make ie 11 work for win 10 is by setting initialBrowserUrl capabilities to https://my-page:9443 like below
capabilities.setCapability("initialBrowserUrl", "https://my-page:9443");
but I am still confused why for ie11 / windows 10 it's different ?
I am using IE 11 - 64 bit windows machine. This point worked for me.
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.