我尝试了以下代码100次仍然出现此错误:
启动Internet Explorer时出现意外错误。无法从窗口句柄获取文档(NoSuchDriver)
除了没有价值的保护区同步之外,这个错误并不多。
InternetExplorerOptions options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
IWebDriver driver = new InternetExplorerDriver(
pathContainingIEDriverServer, options);
driver.Navigate().GoToUrl("http://www.google.com");
IWebElement searchTermTB = driver.FindElement(By.Name("q"));
searchTermTB.SendKeys("jimmy collins blog");
IWebElement searchBtn = driver.FindElement(By.Name("btnG"));
searchBtn.Click();
driver.Close();