How to instantiate InternetExplorerDriver with Selenium WebDriver using C#

后端 未结 5 1290
抹茶落季
抹茶落季 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:13

    The .NET bindings don't scan the %PATH% environment variable for the executable.

    https://groups.google.com/forum/?fromgroups#!topic/webdriver/EvTyEPYchxE

    Hence, it does not work to put IEDriverServer in the %PATH% for .NET.

    Use the unofficial NuGet version with the IE-driver bundled (it is put in the Packages-dir and referenced from the test-project), or bundle it yourself with the project, and mark the exe as Copy if newer under preferences. Then add the relative path into the constructor of InternetExplorerDriver.

提交回复
热议问题