Note that there are some explanatory texts on larger screens.

plurals
  1. POUnit Testing with WatiN and NUnit
    primarykey
    data
    text
    <p>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.</p> <p>I've downloaded the latest release of WatiN (2.0.20.1089) and am trying to create the NUnit / WatiN equivalent of Hello, World:</p> <pre><code>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"); } } </code></pre> <p>This tips IE(8) over after an eventual timeout with the following stack trace:</p> <blockquote> <p>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</p> </blockquote> <p>I have the requisite config file in my bin\debug folder (Foo.Browser.Tests.dll.config) as specified on the <a href="http://watin.sourceforge.net/apartmentstateinfo.html#nunit" rel="noreferrer">WatiN documentation page</a>, so what else is it likely to be? Does anyone have any suggestions for what might be causing the problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload