我想为Visual Studio 2010安装Wating。我在网站上看到了他们的视频,并按照步骤操作,但在安装NuGet时出现了一些错误。无法安装Watin for Visual Studio
这就是我现在做的事:
- 新项目 - > C#形式
- 项目 - >添加引用 - >添加了网4 DLL WatiN.Core.dll
- 添加该代码我的项目(从他们的网站,这是添加到下面的源)
我得到这个错误:
“形式”我'System.Windows.Forms.Form'和'WatiN.Core.Form'之间的模糊引用 'WatiN.Core.Form'不包含带0参数的构造函数 名称'Assert'不存在于当前上下文
这里是我的应用程序代码(我加了使用Watin.Core太):
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.Form'顶部你的C#文件。 – vcsjones
谢谢,但现在我得到这个:错误无法找到类型或名称空间名称'WatiN'(您是否缺少使用指令或程序集引用?) – icebox19
您有使用WatiN.Core吗? – Arran