I'm experimenting with Watin in Visual Studio 2012 (C#), but I cannot seem to get anything to work. Currently I have two text boxes in an aspx page (txtbox1 and txtbox2). I am trying to have Watin automatically input numbers into these two text boxes and then click on the "Calculate" button which will add the two numbers together. I installed the Watin framework and added the Watin.Core dll as a reference. Here is my code for so far in my .aspx page:
using WatiN.Core;
[STAThread]
protected void Page_Load(object sender, EventArgs e)
{
IE ie = new IE("http://localhost:5243/Addition.aspx");
ie.TextField(Find.ByName("txtbox1")).TypeText("1");
ie.TextField(Find.ByName("txtbox2")).TypeText("2");
ie.Button(Find.ByValue("Calculate")).Click();
}
I keep getting the error message stating:"The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer". Do you know what can cause this? Thanks for any help in advance!