"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 .

Answers


Per Jim Evans (who works on IEDriverServer)

The .NET bindings don't scan the %PATH% environment variable for the executable. That means for the .NET bindings only, the IEDriverServer.exe is expected to either be found in the same directory as the .NET bindings assembly, or you must specify the directory where it can be found in the constructor to the InternetExplorerDriver class.

Failure to do one of these things (or to set the UseInternalServer property in the InternetExplorerOptions class) will cause the .NET IE driver implementation to throw an exception. This is strictly by design, as we want people to begin using the standalone IEDriverServer.exe, and the ability to use an "internal" or "legacy" version of the server will be removed in a future release.

https://groups.google.com/forum/?fromgroups#!topic/webdriver/EvTyEPYchxE


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're working with Visual Studio and C# I've updated my NareshScaler nuget package to install IEDriverServer, ChromeDriver etc automatically, meaning you can get up and running quicker.

http://nuget.org/packages/NareshScaler


Code for WebDriver using java to run with IE. I believe this concept might be helpful for you using C#:

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);      
File file = new File("C:\\Program Files\\Internet Explorer\\iexplore.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
driver = new InternetExplorerDriver(capabilities);

If above code doesn't work use the following instead of "File file = new File("C:\Program Files\Internet Explorer\iexplore.exe");":

File file = new File("F:\\Ripon\\IEDriverServer_Win32_2.25.2\\IEDriverServer.exe");

[Note: The version of IEDriverServer and Windows (32 or 64 bit) may vary individual to individual]


Give path only till folder where Internetexplorer.exe is located.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.IE;
using System.IO;

namespace Automation
  {
    class To_Run_IE
     {
        static void Main(string[] args)
        {
         //Keep Internetexplorer.exe in "D:\Automation\32\Internetexplorer.exe"
          IWebDriver driver = new InternetExplorerDriver(@"D:\Automation\32\"); \\Give path till the exe folder
         //IWebDriver driver = new Firefoxdriver()
       driver.Navigate().GoToUrl("http://www.google.com/");
       driver.Manage().Window.Maximize();         
       IWebElement query = driver.FindElement(By.Name("q"));
       query.SendKeys("Cheese");        
       query.Submit();         
       System.Console.WriteLine("Page title is: " + driver.Title);
       driver.Quit();
    }
} }

      public IWebDriver IEWebDriver()
    {
        var options = new InternetExplorerOptions();
        options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
        webDriver = new   InternetExplorerDriver(ConfigurationSettings.AppSettings["IDEServerPath"].ToString(), options);//Path of ur IE WebDriver,Here I stored it in a AppConfig File
        return webDriver;
   }

Need Your Help

jQuery - Count list children not containing div with class

jquery html-lists jquery-traversing

I have a simple js script that counts the number of children an unordered list has. I'm trying to change the script so it doesn't count any children (li) which contain a div with the class 'hidden...

MKMapView get zoom level in feet per screen inch

ios mkmapview zoom mapkit

I am trying to figure out the zoom level of an MKMapView in feet per screen inch. Has anyone done anything like this before, or know of any quick categories which would provide this type of behavior?