Search code examples
c#seleniuminternet-explorer-10ui-automation

Unexpected error launching Internet Explorer. Could not get document from window handle (NoSuchDriver)


I tried the code below a 100 times and still get this error:

Unexpected error launching Internet Explorer. Could not get document from window handle (NoSuchDriver)

Not much on this error except the Protected Zone sync which is worthless.

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();

Solution

  • Turns out the webBrowser control in WinForms had every I need after all