c# - 运行我的 c# Selenium WebDriver 代码的 NUnit 错误

标签 c# visual-studio selenium selenium-webdriver nunit

我正在使用 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.

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

最佳答案

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

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

关于c# - 运行我的 c# Selenium WebDriver 代码的 NUnit 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11056797/

相关文章:

c# - 按下WPF/MVVM右上角的关闭图标时如何处理关闭窗口?

C# Enum Flag - 两种绑定(bind)方式 - enum - class -enum

c# - 返回变量是由编译器自动创建的吗?

c# - MVVM + Reactive + WCF 回调

c# - 通用 EventArgs 类未显示在 WinForms 设计器的属性网格上

selenium - 如何在Katalon Studio中获取element的所有子元素

visual-studio - Visual Studio不安装.vsix文件

c++ - 在 createddialog 创建的窗口中捕获 OnMouseMove 消息以进行编辑控件?

java - 以下代码不适用于 Chrome 浏览器

Python + Selenium 有效获取列表中元素的属性