2012-06-14 71 views
0

我想为Visual Studio 2010安装Wating。我在网站上看到了他们的视频,并按照步骤操作,但在安装NuGet时出现了一些错误。无法安装Watin for Visual Studio

这就是我现在做的事:

  1. 新项目 - > C#形式
  2. 项目 - >添加引用 - >添加了网4 DLL WatiN.Core.dll
  3. 添加该代码我的项目(从他们的网站,这是添加到下面的源)

我得到这个错误:

“形式”我'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")); 

     } 
    } 

你觉得呢?

+2

你可能需要添加'使用表= System.Windows.Forms.Form'顶部你的C#文件。 – vcsjones

+0

谢谢,但现在我得到这个:错误无法找到类型或名称空间名称'WatiN'(您是否缺少使用指令或程序集引用?) – icebox19

+1

您有使用WatiN.Core吗? – Arran

回答

1

问题是System.Windows.FormsWatiN.Core都包含Form类的定义。我的建议是删除这两个(其中之一)WatiN.CoreSystem.Windows.Forms和手动引用解决这些问题,像这样:

System.Windows.Forms.Form form = new System.Windows.Forms.Form(); 
+0

谢谢你的回应:) – icebox19

相关问题