“IEDriverServer does not exist” error during running Selenium test with C# in Windows 7

前端 未结 7 1458
青春惊慌失措
青春惊慌失措 2020-12-08 15:01

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:

相关标签:
7条回答
  • 2020-12-08 15:58

    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
            }
        }
    }
    
    0 讨论(0)
提交回复
热议问题