Wednesday, 21 August 2013

IE9 Webdriver NoSuchWindowException

IE9 Webdriver NoSuchWindowException

I have problem with webdriver on IE9 (win7, c#, selenium 2.3). I get
NoSuchWindowException exception. I found that I need to change 'Enable
Protected Mode' for all Security Level to the same value. But I don't want
to change my settings generally and manually, just programmatically for
time of testing. I thought that I've just need to set
IntroduceInstabilityByIgnoringProtectedModeSettings to true and it will be
working, but it doesn't. My code (these lines work ok):
var option = new InternetExplorerOptions();
option.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
IWebDriver Driver = new InternetExplorerDriver(option);
Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
Driver.Navigate().GoToUrl(baseUrl);
This cause exception:
Driver.Manage().Window.Maximize();
An exception of type 'OpenQA.Selenium.NoSuchWindowException' occurred in
WebDriver.dll but was not handled in user code
Additional information: Error retrieving window with handle current
also this:
string pageSource = Driver.PageSource;
An exception of type 'OpenQA.Selenium.NoSuchWindowException' occurred in
WebDriver.dll but was not handled in user code
Additional information: Unable to get browse
Do you have idea what is going wrong/what can I do to run my test?

No comments:

Post a Comment