4

I'm researching selenium webdriver in C#. When I run the test case to test browser IE, then this error:

Test method AgileTravelUITests.GoogleSearchTest.TestIE threw exception: OpenQA.Selenium.DriverServiceNotFoundException: The IEDriverServer.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://selenium-release.storage.googleapis.com/index.html.

I tried download and install 2.53 folder with IEDriverServer_x64_2.53.0.zip, but this didn't work.

This is my code:

[TestMethod]
public void TestIE()
{
    IWebDriver driver = new InternetExplorerDriver();

    driver.Navigate().GoToUrl("http://www.google.com");

    IWebElement element = driver.FindElement(By.Name("q"));

    element.SendKeys("Hello Selenium WebDriver!");

    element.Submit();
}

My code is working fine in IE now. You can follow this link Not able to launch IE browser using Selenium2 (Webdriver) with Java Java and C# are the same. Hope it helps.

Community
  • 1
  • 1
NguyenDY
  • 67
  • 1
  • 1
  • 7

2 Answers2

2

Once you’ve downloaded IEDriverServer_x64_2.53.0.zip, extract the zips to a local drive on your computer.

Make sure to add the path to where you extracting the IEDriverServer.exe

using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;

IWebDriver driver = new InternetExplorerDriver(@"path\to\where you extracting the IEDriverServer");
driver.Navigate().GoToUrl("http://www.google.com");

Note :- I'm suggesting you download 32-bit IEDriverService.exe because 64-bit IEDriverService.exe is very very slow for execution.

Alex Kulinkovich
  • 4,408
  • 15
  • 46
  • 50
Saurabh Gaur
  • 23,507
  • 10
  • 54
  • 73
  • I edited like: IWebDriver driver = new InternetExplorerDriver(@"E:\Yumy\Learn\DH\Kiem thu\IEDriverServer.exe"); But it don't run – NguyenDY Jul 27 '16 at 07:32
  • @D.ÝNguyện is there any exception?? – Saurabh Gaur Jul 27 '16 at 07:35
  • @D.ÝNguyện proivde only extracted driver location as `WebDriver driver = new InternetExplorerDriver(@"E:\Yumy\Learn\DH\Kiem thu")`.. no need to pass IEDriverServer.exe as well – Saurabh Gaur Jul 27 '16 at 07:38
  • The IE browser opened and displayed "The IE browser opened and displayed". And It still don't run test case – NguyenDY Jul 27 '16 at 08:31
  • @D.ÝNguyện I think this is the problem of IE security setting follow this link http://stackoverflow.com/questions/14952348/not-able-to-launch-ie-browser-using-selenium2-webdriver-with-java – Saurabh Gaur Jul 27 '16 at 09:09
  • Thank you so much. My code is working fine in IE now – NguyenDY Jul 28 '16 at 02:05
0

You have to Place the IEDriverServer.exe in the Bin directory in c#. I guess in Java you need to Add the path of the IEDriverServer.exe in the Path environment variables.

Siva
  • 1,129
  • 1
  • 8
  • 13