无法为 Visual Studio 安装 Watin [英] Can't install Watin for Visual Studio
问题描述
我想为 Visual Studio 2010 安装 Wating.我在网站上看到了他们的视频,并按照步骤进行了操作,但是在安装 NuGet 时出现了一些错误.
I want to install Wating for Visual Studio 2010. I saw their Video on the website, and followed the steps, but I got some errors while installing NuGet.
这就是我现在所做的:
- 新建项目 -> C# 表单
- 项目 -> 添加引用 -> 添加 Net 4 DLL WatiN.Core.dll
- 将此代码添加到我的项目中(来自他们的网站,添加到下面的源代码中)
我得到这个错误:
'Form' 是 'System.Windows.Forms.Form' 和 'WatiN.Core.Form' 之间的模糊引用'WatiN.Core.Form' 不包含采用 0 个参数的构造函数当前上下文中不存在名称断言"
'Form' is an ambiguous reference between 'System.Windows.Forms.Form' and 'WatiN.Core.Form' 'WatiN.Core.Form' does not contain a constructor that takes 0 arguments The name 'Assert' does not exist in the current context
这是我的应用程序代码(我也使用 Watin.Core 添加了):
Here is my application code (I added using Watin.Core too):
private void Form1_Load(object sender, EventArgs e)
{
using (var browser = new IE("http://www.google.com"))
{
browser.TextField(Find.ByName("q")).TypeText("WatiN");
browser.Button(Find.ByName("btnG")).Click();
Assert.IsTrue(browser.ContainsText("WatiN"));
}
}
你怎么看?
推荐答案
问题是 System.Windows.Forms
和 WatiN.Core
都包含 Form
类.我的建议是删除对 WatiN.Core
和 System.Windows.Forms
的引用(其中之一)并手动解决如下问题:
The problem is that both System.Windows.Forms
and WatiN.Core
contain definitions of Form
class. My suggestion is to delete both(one of) the references to WatiN.Core
and System.Windows.Forms
and manually resolve the issues like so:
System.Windows.Forms.Form form = new System.Windows.Forms.Form();
这篇关于无法为 Visual Studio 安装 Watin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!