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 .
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.
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.
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 } } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With