How to instantiate InternetExplorerDriver with Selenium WebDriver using C#

后端 未结 5 1267
抹茶落季
抹茶落季 2021-01-17 18:45
new InternetExplorerDriver();

But I could see exception as below:

OpenQA.Selenium.DriverServiceNotFoundException was unhandled by u         


        
5条回答
  •  隐瞒了意图╮
    2021-01-17 19:01

    Add these lines to your code before creating the object.

       System.setProperty("webdriver.ie.driver", 
            "E:\\path where your IEDriverServer is located\\IEDriverServer.exe");
    

    You can download IEDriverServer.exe file from here.

    As you are using C# you can use the below code.

    private const string IE_DRIVER_PATH = @"C:\PathTo\IEDriverServer";
    var driver = new InternetExplorerDriver(IE_DRIVER_PATH, options);
    

提交回复
热议问题