7

我正在使用 Visual Studio 用 C# 编写 Selenium WebDriver 代码,然后将其传递给 NUnit 以运行我的测试。

当我第一次构建和调试我的代码时,它会传递给 NUnit,我可以从那里成功运行(加载正确的浏览器加载正确的网页)

直到最近,每当我尝试在 NUnit 中运行它时,都会发生运行错误:

FirstSeleniumTest.SeleniumTest.TestGoogle:
SetUp : OpenQA.Selenium.WebDriverException : You will need to use add InternetExplorerDriver.UseLegacyInternalServer to the desired capabilities to use the internal native code server library. This functionality will be deprecated in favor of the standalone IEDriverServer.exe server.
  ----> OpenQA.Selenium.DriverServiceNotFoundException : The file C:\Users\lbrown\Documents\Visual Studio 2010\Projects\ClassLibrary15\ClassLibrary15\bin\Debug\IEDriverServer.exe does not exist. The driver can be downloaded at http://code.google.com/p/selenium/downloads/list
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

我下载了它告诉我的驱动程序,但我不确定下一步该做什么或将它放在我的代码中的什么位置。

4

1 回答 1

3

解压缩驱动程序,并将其放在与运行测试相同的文件夹中。将其添加到 Visual Studio 中的项目中,确保其构建属性设置为“始终复制”。这将确保它始终复制到与包含测试的已编译 .DLL 文件相同的构建目录。

您可以稍后移动它,但当它与测试位于同一文件夹中时,它会正常工作。

于 2012-06-15T22:33:29.393 回答