locked
Selenium Data Driven Test cannot find The file C:/Windows/System32/IEDriverServer.exe does not exist. RRS feed

  • Question

  • OpenQA.Selenium.DriverServiceNotFoundException was unhandled by user code
      HResult=-2146233088
      Message=The file C:/Windows/System32/IEDriverServer.exe does not exist. The driver can be downloaded at http://selenium-release.storage.googleapis.com/index.html
      Source=WebDriver
      StackTrace:
           at OpenQA.Selenium.DriverService..ctor(String servicePath, Int32 port, String driverServiceExecutableName, Uri driverServiceDownloadUrl)
           at OpenQA.Selenium.IE.InternetExplorerDriverService..ctor(String executablePath, String executableFileName, Int32 port)
           at OpenQA.Selenium.IE.InternetExplorerDriver..ctor(String internetExplorerDriverServerDirectory, InternetExplorerOptions options)
           at OpenQA.Selenium.IE.InternetExplorerDriver..ctor(String internetExplorerDriverServerDirectory)
           at CPS1_Automation_SE.TestCases.Login_Google.Googletest() in C:\Users\Christopher.Hall\Documents\SafeAutomation\CPS1_Automation_SE_DataDriven\CPS1_Automation_SE\TestCases\Login_Google.cs:line 42
      InnerException:

    BUT the file does exist and is used by other non-data driven tests.

    Code is here >

    using System;
    using System. Threading;
    using System. Collections. Generic;
    using System. Linq;
    using System. Text;
    using OpenQA. Selenium;
    using OpenQA. Selenium. IE;
    using OpenQA.Selenium.Support.UI;
    using NUnit. Framework;
    using System.Configuration;
    using CPS1_Automation_SE. Controllers;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    namespace CPS1_Automation_SE.TestCases
    {
       [TestClass]
        public class Login_Google
        {
            //protected IWebDriver driver;
            IWebDriver driver;
            //protected Login_Factory objLogin;
            //       protected AdminMenu_Factory objAdminMenu;
            private Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContextInstance;
            public Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
            {
                get
                {
                    return testContextInstance;
                }
                set
                {
                    testContextInstance = value;
                }
            }
            [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\data.csv", "data#csv", DataAccessMethod.Sequential), DeploymentItem("data.csv"), TestMethod]
            public void Googletest()
            {
                driver = new InternetExplorerDriver("C:/Windows/System32/");
                //driver.Manage().Window.Maximize();
                ////driver. Url = ConfigurationManager. AppSettings["URL"];
                //driver.Url = "https://google.co.uk";
                ////driver.Url = TestContext.DataRow["URL"].ToString();
                //driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(60));
                //driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(100));
               
                 string searchterm = TestContext.DataRow["Search"].ToString();
                Thread.Sleep(5000);
                            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Public\TestFolder\Output\Login_Google.txt", true))
                {
                    file.WriteLine("Completed Iteration" + searchterm);
                }
            }
        }
    }

    Friday, October 7, 2016 8:50 AM

Answers

  • Hi Chris_Tester,

    I have encountered the same issue as you. Just as Tim said, selenium data-driven test does not work when DataSource attribute be added to the TestMethod(). When I removed the DateSource attribute and the TestMethod for selenium could run without any problems.

    So I think if you want to test data-driven test for selenium, I think we could use FileInputStream to get .xls file or other APIs that could read .xls and .csv files.

    incerely,

    Oscar


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by Chris_Tester Wednesday, October 19, 2016 7:30 AM
    Wednesday, October 19, 2016 7:22 AM

All replies

  • Total shot in the dark here.  Does the exception change or go away if you run visual studio as admin? If you downloaded the file is there any chance the assembly is blocked(right click on the file select properties)? Are you running the test in the IDE or as a part of a build?

    Tim

    Friday, October 7, 2016 2:32 PM
  • Thanks Tim,

    Running visual studio as admin makes no difference and the selenium test works fine if I remove the data driving parts (i.e particularly:- private Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContextInstance;
            public Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
            {
                get
                {
                    return testContextInstance;
                }
                set
                {
                    testContextInstance = value;
                }
            }
            [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\data.csv", "data#csv", DataAccessMethod.Sequential), DeploymentItem("data.csv"), TestMethod]

    The test is being run locally from the TestExplorer window

    Friday, October 7, 2016 4:01 PM
  • The next thing I would try is create a data driven unit test without selenium and see if you are getting a weird error because of a deployment issue.  BTW is your data.csv file getting deployed properly?  A final thought,  NUnit allows you to data drive tests without using flat files (I hope MS gives us that).  The attributes are different but switching between the frameworks is pretty comfortable - you might consider trying nunit plus selenium to see if it behaves better

    Tim

    Friday, October 7, 2016 5:05 PM
  • Hi Chris_Tester,

    According to the error message, please download the IEWebDriver from the following site (32 bit or 64 bit):

    http://www.seleniumhq.org/download/

    Then copy the “IEDriverServer” file to your Debug folder. Just as the following screenshot:

    And rewrite your code

    driver = new InternetExplorerDriver("C:/Windows/System32/");

    as

    driver = new InternetExplorerDriver();

    Sincerely,

    Oscar


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


    • Edited by Oscar_Wu Monday, October 10, 2016 3:25 AM
    • Proposed as answer by Oscar_Wu Thursday, October 13, 2016 8:28 AM
    • Unproposed as answer by Oscar_Wu Wednesday, October 19, 2016 5:27 AM
    Monday, October 10, 2016 3:07 AM
  • Data driven tests without selenium work OK using both csv and excel files.

    We want to use Visual Studio to store and run our tests so that they can be seen alongside manual tests, so Nunit is not an option.

    Tuesday, October 18, 2016 12:11 PM
  • I have tried this and the test reports failure with message:

    Test method CPS1_Automation_SE.TestCases.Login_Google.Googletest 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.

    Tuesday, October 18, 2016 12:13 PM
  • It sounds like non-datadriven tests with selenium work and data driven tests with selenium don't?  If so seems like some sort of deployment issue.  At this point I would fire up Process Monitor, reproduce the issue then llok over the logs


    Tim

    • Proposed as answer by Oscar_Wu Wednesday, October 19, 2016 7:13 AM
    Tuesday, October 18, 2016 3:02 PM
  • Hi Chris_Tester,

    I have encountered the same issue as you. Just as Tim said, selenium data-driven test does not work when DataSource attribute be added to the TestMethod(). When I removed the DateSource attribute and the TestMethod for selenium could run without any problems.

    So I think if you want to test data-driven test for selenium, I think we could use FileInputStream to get .xls file or other APIs that could read .xls and .csv files.

    incerely,

    Oscar


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by Chris_Tester Wednesday, October 19, 2016 7:30 AM
    Wednesday, October 19, 2016 7:22 AM