IE9上的webdriver有问题(win7,c#,selenium 2.3)。我得到NoSuchWindowException
例外。
我发现我需要将所有安全级别的“启用保护模式”更改为相同的值。但我不想一般地手动更改我的设置,只是以编程方式更改测试时间。我认为我只需要将IntroduceInstabilityByIgnoringProtectedModeSettings
设置为true
它就可以了,但事实并非如此。我的代码(这些行正常工作):
var option = new InternetExplorerOptions();
option.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
IWebDriver Driver = new InternetExplorerDriver(option);
Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
Driver.Navigate().GoToUrl(baseUrl);
这导致异常:
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
也是这样:
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
你知道出了什么问题/我该怎么做才能运行我的测试?