This is related to my other recent question on Selenium (that question was about a Firefox-specific issue, this one is about an IE-specific issue).
Basically, when I ran the following code
ieDriver.Navigate().GoToUrl("http://localhost:51282");
IWebElement linkToAboutPage = ieDriver.FindElement(By.Id("test"));
linkToAboutPage.Click();
to simulate clicking on a link, it successfully navigates to the page but when it tries to retrieve the actual element I get the following exception:
An exception of type 'OpenQA.Selenium.NoSuchWindowException' occurred in WebDriver.dll but was not handled in user code
Additional information: Unable to find element on closed window
The accepted answer to this question suggests that "Enable Protected Mode" in IE Security Settings should either be all selected or all unselected. Indeed, when I look at these settings, "Enable Protected Mode" is unselected for Intranet but not for the others:
Unfortunately, as the screenshot shows, that's being managed by my corporate IT department and I'm not sure that I'll have much luck convincing them to let me change the settings. I was also unable to edit my registry in the way suggested by some of the other answers (presumably due to the lack of administrative rights).
Some of the other solutions I've seen include setting IntroduceInstabilityByIgnoringProtectedModeSettings
to true
, providing a InitialBrowserUrl
, or setting EnsureCleanSession
to true
. As shown below, I'm currently doing all of those things:
var ieOptions = new InternetExplorerOptions()
{
InitialBrowserUrl = "http://www.google.com",
IntroduceInstabilityByIgnoringProtectedModeSettings = true,
IgnoreZoomLevel = true,
EnableNativeEvents = true,
EnsureCleanSession = true
};
ieDriver = new InternetExplorerDriver(ieOptions);
ieDriver.Manage().Timeouts().ImplicitWait = new TimeSpan(0, 0, 10);
However, I'm still having the exact same problem.
Is there something else I can try that doesn't involve me bugging corporate IT for policy exceptions?
Perhaps significantly, this only happens when I'm running on localhost
(which is a problem because that's where I intend to do most of my testing).