简体   繁体   English

无法为Visual Studio安装Watin

[英]Can't install Watin for Visual Studio

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. 我想安装Wating for Visual Studio2010。我在网站上看到了他们的视频,并按照步骤操作,但是在安装NuGet时遇到一些错误。

This is what I did now: 这就是我现在所做的:

  1. New project -> C# Form 新项目-> C#表单
  2. Project -> Add reference -> Added the Net 4 DLL WatiN.Core.dll 项目->添加参考->添加了Net 4 DLL WatiN.Core.dll
  3. Added this code to my project (from their website, which is added to the source below) 将此代码添加到我的项目中(从他们的网站,添加到下面的源中)

And I get this errors: 我得到这个错误:

'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 “ Form”是“ System.Windows.Forms.Form”和“ WatiN.Core.Form”之间的模棱两可的引用。“ WatiN.Core.Form”不包含带有0个参数的构造函数。名称“ Assert”在其中不存在目前的情况

Here is my application code (I added using Watin.Core too): 这是我的应用程序代码(我也是使用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"));

        }
    }

What do you think ? 你怎么看 ?

The problem is that both System.Windows.Forms and WatiN.Core contain definitions of Form class. 问题在于System.Windows.FormsWatiN.Core都包含Form类的定义。 My suggestion is to delete both(one of) the references to WatiN.Core and System.Windows.Forms and manually resolve the issues like so: 我的建议是删除对WatiN.CoreSystem.Windows.Forms的引用(之一),并手动解决以下问题:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有Visual Studio for Mac的SocketIoClientDotNet无法安装 - SocketIoClientDotNet with Visual Studio for mac can't install 无法在Visual Studio 2012中安装任何NuGets - Can't install any NuGets in Visual Studio 2012 无法安装 Visual Studio 代码 C# 扩展 - Can't install the visual studio code C# extension 无法在Visual Studio Ultimate 2012上安装BenchmarkDotNet 0.10.2 - Can't install BenchmarkDotNet 0.10.2 on Visual Studio Ultimate 2012 无法将RestSharp for Mobile Apps安装到Visual Studio for Xamarin中 - Can't install RestSharp for Mobile Apps into visual Studio for Xamarin 无法安装或卸载 Visual Studio 2017/2019 - Can't Install or Uninstall Visual Studio 2017/2019 为什么在未安装Visual Studio的计算机中无法运行.NET程序的调试版本 - Why can't I run debug version of .NET program in the machine didn't install visual studio 如何在未安装Visual Studio的计算机上安装Windows服务? - How can I install a windows service onto a machine that doesn't have Visual Studio installed? Visual Studio 无法安装 Android SDK(API 级别 19 和 21)(缺少 extra-android-support) - Visual Studio can't install Android SDK (API level 19 and 21) (missing extra-android-support) 无法在 Visual Studio 2015 中的包管理控制台安装 Twillio 包 - Can't install Twillio package at package manage console in Visual Studio 2015
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM