1

I'm trying to get started using Selenium by running some of the samples. I've seen others having trouble at run time getting the InternetExplorerDrive working, see How to instantiate InternetExplorerDriver with Selenium WebDriver using C#, but my problem is different. I get a compile time error that InternetExlorerDriver could not be found. I've installed all four "Official NuGet Packages: RC WebDriver WebDriverBackedSelenium Support" in my project.

I have the IEDriverServer.exe added to the project too but I'm not getting that far yet.

What reference am I missing?

using System;
using System.Threading;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;

namespace SeleniumTest
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create a new instance of the Firefox driver.

            // Notice that the remainder of the code relies on the interface, 
            // not the implementation.

            // Further note that other drivers (InternetExplorerDriver,
            // ChromeDriver, etc.) will require further configuration 
            // before this example will work. See the wiki pages for the
            // individual drivers at http://code.google.com/p/selenium/wiki
            // for further information.
            IWebDriver driver = new InternetExlorerDriver(); //missing reference error here

Compile time error:

Error   1   The type or namespace name 'InternetExlorerDriver' could not be found (are you missing a using directive or an assembly reference?) c:\users\chadd\documents\visual studio 2013\Projects\SeleniumWebDr\SeleniumTest\Program.cs  22  37  SeleniumTest
Community
  • 1
  • 1
Chad Dienhart
  • 5,024
  • 3
  • 23
  • 30

2 Answers2

1

I notice that in your code, you don't have a using statement for the IE driver's namespace. Add the following line to your source code:

using OpenQA.Selenium.IE;

See if that doesn't resolve the issue.

Additionally, in your code, you're attempting to instantiate a class named InternetExlorerDriver. You're missing a p there. InternetExplorerDriver is what you want.

Incidentally, Visual Studio should provide you with tooltip support to correct this issue.

JimEvans
  • 27,201
  • 7
  • 83
  • 108
0

You have to download the IE Explorer driver from selenium hq site in order to invoke the Internet explorer browser as selenium only supports firefox as its default browser.

Please find below the link: http://www.seleniumhq.org/download/ download the 32 bit or 64 bit internet explorer driver server and just add the below setting in your script:

 System.setProperty("webdriver.ie.driver",
                System.getProperty("user.dir") + "\\IEDriverServer.exe");
    Webdriver driver = new InternetExplorerDriver();

assuming you have kept the exe file in the same project folder. hope this helps !!

Ram Pasala
  • 4,931
  • 3
  • 16
  • 26
  • That doesn't work in C#, see http://stackoverflow.com/questions/16528446/cannot-call-selenium-2-system-setpropertywebdriver-ie-driver-from-c-sharp Unfortunately that is what I'm trying but it doesn't work because I get a missing reference compile time error. – Chad Dienhart Aug 27 '15 at 16:50