问题
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:
- New project -> C# Form
- Project -> Add reference -> Added the Net 4 DLL WatiN.Core.dll
- 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