Can't install Watin for Visual Studio

寵の児 提交于 2019-12-12 01:42:23

问题


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.

This is what I did now:

  1. New project -> C# Form
  2. Project -> Add reference -> Added the 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

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"));

        }
    }

What do you think ?


回答1:


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();


来源:https://stackoverflow.com/questions/11034783/cant-install-watin-for-visual-studio

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!