It seems that the common theme among SO questions regarding WatiN have to do with actually getting the thing working and I'm no exception.
I've downloaded the latest release of WatiN (2.0.20.1089) and am trying to create the NUnit / WatiN equivalent of Hello, World:
using WatiN.Core;
using NUnit.Framework;
namespace Foo.Browser.Tests
{
[TestFixture]
public class BrowserTests
{
[Test]
[STAThread]
public void ExampleTest()
{
IE ie = new IE("http://www.google.com");
ie.TextField(Find.ByName("q")).TypeText("WatiN");
ie.Button(Find.ByValue("Google Search")).Click();
Link link = ie.Link(Find.ByUrl("http://watin.sourceforge.net/"));
Assert.That(link.Text == "WatiN Home");
}
[Test]
public void FirefoxTest()
{
FireFox ff = new FireFox("http://www.google.com");
ff.TextField(Find.ByName("q")).TypeText("WatiN");
ff.Button(Find.ByValue("Google Search")).Click();
Link link = ff.Link(Find.ByUrl("http://watin.sourceforge.net/"));
Assert.That(link.Text == "WatiN Home");
}
}
This tips IE(8) over after an eventual timeout with the following stack trace:
at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.ThrowTimeOutException(Exception lastException, String message) at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.HandleTimeOut() at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.Try[T](DoFunc'1 func) at WatiN.Core.WaitForCompleteBase.WaitUntil(DoFunc'1 waitWhile, BuildTimeOutExceptionMessage exceptionMessage) at WatiN.Core.Native.InternetExplorer.IEWaitForComplete.WaitWhileFrameDocumentNotAvailable(IWebBrowser2 frame) at WatiN.Core.Native.InternetExplorer.IEWaitForComplete.WaitForFramesToComplete(IHTMLDocument2 maindocument) at WatiN.Core.Native.InternetExplorer.IEWaitForComplete.WaitForFramesToComplete(IHTMLDocument2 maindocument) at WatiN.Core.Native.InternetExplorer.IEWaitForComplete.WaitForCompleteOrTimeout() at WatiN.Core.WaitForCompleteBase.DoWait() at WatiN.Core.DomContainer.WaitForComplete(IWait waitForComplete) at WatiN.Core.IE.WaitForComplete(Int32 waitForCompleteTimeOut) at WatiN.Core.DomContainer.WaitForComplete() at WatiN.Core.Browser.GoTo(Uri url) at WatiN.Core.IE.FinishInitialization(Uri uri) at WatiN.Core.IE.CreateNewIEAndGoToUri(Uri uri, IDialogHandler logonDialogHandler, Boolean createInNewProcess) at WatiN.Core.IE..ctor(String url) at Foo.Browser.Tests.BrowserTests.ExampleTest() in C:\Development\Foo\Foo.Browser.Tests\BrowserTests.cs:line 19
I have the requisite config file in my bin\debug folder (Foo.Browser.Tests.dll.config) as specified on the WatiN documentation page, so what else is it likely to be? Does anyone have any suggestions for what might be causing the problem?