【问题标题】:Selenium - Calling project DLL to run test cases c# issueSelenium - 调用项目 DLL 来运行测试用例 c# 问题
【发布时间】:2019-06-05 17:57:06
【问题描述】:

我试图通过从 cmd 调用 debug dll 来运行测试用例,但由于我在日志文件中发现一个错误,所有测试都失败了:

测试方法 SeleniumUnitTest.SearchTests.SearchByProviderLocationTest 抛出 例外: OpenQA.Selenium.DriverServiceNotFoundException:IEDriverServer.exe 文件不存在于当前目录或 PATH 环境变量中的目录。司机可以 下载于 http://selenium-release.storage.googleapis.com/index.html.

IEDriverServer.exe 不存在,但驱动程序已经在 DLL 目录中......我从 Visual Studio 运行单元测试时也没有问题。

我运行的命令是:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest.exe" /testcontainer:"C:\Users\John\Source\Repos\APP\Src\App.TestSelenium\bin\Debug\App.TestSelenium.dll"

有什么想法吗?

谢谢。

【问题讨论】:

    标签: c# selenium internet-explorer testing


    【解决方案1】:

    有两种方法可以解决此问题

    1. 将 InternetExplorer.exe 存储在公共文件夹中,并将其添加到环境 PATH 变量中。这是避免将驱动程序存储在解决方案文件夹中的麻烦的最佳方法
    2. 但如果您想更好地控制驱动程序的版本,最好将所有驱动程序放在解决方案根文件夹中,然后在初始化驱动程序时指定路径

      var driver = new InternetExplorerDriver((Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)));
      

    【讨论】:

      猜你喜欢
      • 2014-10-06
      • 1970-01-01
      • 1970-01-01
      • 2013-02-27
      • 1970-01-01
      • 1970-01-01
      • 2021-06-25
      • 2018-03-24
      • 2014-01-18
      相关资源
      最近更新 更多