Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"IEDriverServer does not exist" error during running Selenium test with C# in Windows 7

I'm working on Automation framework using WebDriver with C#. Its working fine with Firefox but not with IE.

I am getting the following error:

IEDriverServer.exe does not exist-The file c:\users\administrator\documents\visual studio 2010\projects\TestProject1\TestProject1\bin\Debug\IEDriverServer.exe does not exist. The driver can be downloaded at http://code.google.com/p/selenium/downloads/list

I am using IE 9 and Windows 7.

IWebDriver driver = new InternetExplorerDriver(); driver.Navigate().GoToUrl("http://www.google.co.uk"); IWebElement queryBox = driver.FindElement(By.Name("q")); queryBox.SendKeys("The Automated Tester"); queryBox.SendKeys(Keys.ArrowDown); queryBox.Submit(); 

See also this screenshot.

like image 855
Pat Avatar asked Jun 13 '12 07:06

Pat


People also ask

Does Selenium support Internet Explorer?

To configure IE Driver with Selenium, so as we can run Selenium tests on Internet Explorer, the IE Driver executable file should be made available to the test scripts.


2 Answers

The IEDriverServer.exe (as well as ChromeDriver.exe) can be downloaded from:

http://selenium-release.storage.googleapis.com/index.html.

To get these to work with your Selenium tests, include the .exe in your test project, and set its properties to 'Copy Always'.

NOTE: You'll have to adjust the Add File dialog to display .exe files.

Doing this will resolve the error.

like image 102
Peter Bernier Avatar answered Sep 21 '22 23:09

Peter Bernier


Here's a simple C# example of how to call the InternetExplorerDriver using the IEDriverServer.exe.

Refactor according to your needs.

Note: the use of driver.Quit() which ensures that the IEDriverServer.exe process is closed, after the test has finished.

using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenQA.Selenium.IE;  namespace SeleniumTest {     [TestClass]     public class IEDriverTest     {         private const string URL = "http://url";         private const string IE_DRIVER_PATH = @"C:\PathTo\IEDriverServer.exe";          [TestMethod]         public void Test()         {             var options = new InternetExplorerOptions()             {                 InitialBrowserUrl = URL,                 IntroduceInstabilityByIgnoringProtectedModeSettings = true             };             var driver = new InternetExplorerDriver(IE_DRIVER_PATH, options);             driver.Navigate();             driver.Close(); // closes browser             driver.Quit(); // closes IEDriverServer process         }     } } 
like image 21
Ralph Willgoss Avatar answered Sep 24 '22 23:09

Ralph Willgoss