无法为 Visual Studio 安装 Watin [英] Can't install Watin for Visual Studio

查看:34
本文介绍了无法为 Visual Studio 安装 Watin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为 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.

这就是我现在所做的:

  1. 新建项目 -> C# 表单
  2. 项目 -> 添加引用 -> 添加 Net 4 DLL WatiN.Core.dll
  3. 将此代码添加到我的项目中(来自他们的网站,添加到下面的源代码中)

我得到这个错误:

'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.FormsWatiN.Core 都包含 Form 类.我的建议是删除对 WatiN.CoreSystem.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆