Using WatiN in a console or WinForms application

When using WatiN from a console or WinForms application, you need to apply the [STAThread] attribute to the Main method (the entry point of the application).

using System;
using WatiN.Core;
 
namespace WatiNGettingStarted
{
 class WatiNConsoleExample
 {
  [STAThread]
  static void Main(string[] args)
  {
   // Your test code;
  }
 }
}

See the Getting Started article for a full console application example.