How do I setup the InternetExplorerDriver so it works

114,207

Solution 1

Unpack it and place somewhere you can find it. In my example, I will assume you will place it to C:\Selenium\iexploredriver.exe

Then you have to set it up in the system. Here is the Java code pasted from my Selenium project:

File file = new File("C:/Selenium/iexploredriver.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
WebDriver driver = new InternetExplorerDriver();

Basically, you have to set this property before you initialize driver

Reference:

Solution 2

If you are using RemoteDriver things are different. From http://element34.ca/blog/iedriverserver-webdriver-and-python :

You will need to start the server using a line like

java -jar selenium-server-standalone-2.26.0.jar -Dwebdriver.ie.driver=C:\Temp\IEDriverServer.exe

I found that if the IEDriverServer.exe was in C:\Windows\System32\ or its subfolders, it couldn't be found automatically (even though System32 was in the %PATH%) or explicitly using the -D flag.

Solution 3

Another way to resolve this problem is:

Let's assume:

path_to_driver_directory = C:\Work\drivers\

driver = IEDriverServer.exe

When getting messsage about path you can always add path_to_driver_directory containing driver to the PATH environment variable. Check: http://java.com/en/download/help/path.xml

Then simply check in cmd window if driver is available - just run cmd in any location and type name of driver.

If everything works fine then you get:

C:\Users\A>IEDriverServer.exe
Started InternetExplorerDriver server (32-bit)
2.28.0.0
Listening on port 5555

Thats it.

Solution 4

This is just to help somebody in future. When we initiate InternetExplorerDriver() instance in a java project it uses IEDriver.exe (downloaded by individuals) which tries to extract temporary files in user's TEMP folder when it's not in path then ur busted.

Safest way is to provide your own extract path as shown below

System.setProperty("webdriver.ie.driver.extractpath", "F:\\Study\\");
System.setProperty("webdriver.ie.driver", "F:\\Study\\IEDriverServer.exe");
System.setProperty("webdriver.ie.logfile", "F:\\Study\\IEDriverServer.log");
InternetExplorerDriver d = new InternetExplorerDriver();
d.get("http://www.google.com");
d.quit();
Share:
114,207
DarthOpto
Author by

DarthOpto

By Day: I break programs for a living. By Night: I am a holy warrior of the light in World of Warcraft.

Updated on September 20, 2020

Comments

  • DarthOpto
    DarthOpto over 3 years

    I am using WebDriver and I have downloaded the InternetExplorerDriver and was wondering what I do with it after it is downloaded?

    This says to put the driver in my path. Not really certain what exactly they are talking about there.

    Has anyone used this and if so could you provide detailed steps on how to set it up so it will work?

    I am getting the following error:

    The path to the driver executable must be set by the webdriver.ie.driver system property

    I downloaded the executables for IE and the Chrome driver. Where do I set it at?

  • DarthOpto
    DarthOpto almost 12 years
    David, thank you for those links, however they did not answer my question about how to point the test to the driver executables.
  • Khushboo
    Khushboo almost 9 years
    Yes!! Thanks a ton. Everywhere it is written that you have to mention it in the System path but to hell it is no where written that we have to start the driver also. The same is true with Chrome also. RemoteWebDriver doc should be updated and should be in sync.