大家好,
我将Selenium与各种驱动程序一起使用,但是今天当我第一次使用IED驱动程序时,我得到了例外:"Error retrieving window with handle current"
我的代码是:
private static IWebDriver driver;
InternetExplorerDriverService driverService = InternetExplorerDriverService.CreateDefaultService();
InternetExplorerOptions IEOptions = new InternetExplorerOptions();
driverService.HideCommandPromptWindow = true;
driverService.LibraryExtractionPath = Environment.CurrentDirectory;
driverService.Port = 8080;
IEOptions.EnableNativeEvents = true;
IEOptions.IgnoreZoomLevel = true;
IEOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
driver = new InternetExplorerDriver(driverService, IEOptions, TimeSpan.FromSeconds(120));
js = driver as IJavaScriptExecutor;
wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeToWait));
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(ImplicitlyWaitTime));
driver.Navigate().GoToUrl("something");
driver.Manage().Window.Maximize(); //*
它加载网站,当我调用Maximize时,程序抛出异常(之后我无法对该驱动程序对象做任何事情[窗口处理程序丢失])
仅在IE驱动程序中发生这种情况(我尝试过32位和64位版本)。
我正在使用最新版本的Selenium。
感谢。