We have a collection of WATIN tests we are using CruiseControl to run every hour. All the tests pass on our local machine - but when they are run using CruiseControl we get sporadic failures.
We are using CruiseControl using the command line. We are not using the CruiseControl service. We are using IE8.
Before each test is run - we use WATIN to close all instances of the browser to make sure each test is completely isolated.
Here is an example of the stack trace we are seeing when the exception is thrown:
Message: WatiN.Core.Exceptions.TimeoutException : Timeout while Internet Explorer busy
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.WaitForComplete.WaitWhileIEBusy(IWebBrowser2 ie)
at WatiN.Core.Native.InternetExplorer.IEWaitForComplete.DoWait()
at WatiN.Core.DomContainer.WaitForComplete(IWait waitForComplete)
at WatiN.Core.IE.WaitForComplete(Int32 waitForCompleteTimeOut)
at WatiN.Core.DomContainer.WaitForComplete()
at WatiN.Core.Element.WaitForComplete()
at WatiN.Core.Element.Click()
at Symetra.Web.Core.AutomatedTesting.WatiNTests.CommonTests.LinkTest(Browser browser, String linkText, String message) in d:\Source\BuildArea\OSS\Symetra.Web.Core.AutomatedTesting\Symetra.Web.Core.AutomatedTesting.WatiNTests\Common\CommonTests.cs:line 63
at Symetra.Web.Core.AutomatedTesting.WatiNTests.CommonTests.LinkTest(Browser browser, String linkText) in d:\Source\BuildArea\OSS\Symetra.Web.Core.AutomatedTesting\Symetra.Web.Core.AutomatedTesting.WatiNTests\Common\CommonTests.cs:line 57
at Symetra.Web.Core.AutomatedTesting.WatiNTests.GlowTests.BreadCrumbFixture.testid1Test() in d:\Source\BuildArea\OSS\Symetra.Web.Core.AutomatedTesting\Symetra.Web.Core.AutomatedTesting.WatiNTests\GlowTests\BreadCrumbFixture.cs:line 72
Is there anything we do to prevent this? I’ve tried putting Thread.Sleep() in front of the offending lines. That does not seem to have an effect. I’ve been pretty careful to avoid Thread.Sleep()- and use browser.WaitUntilContainsText.
I’ve searched StackOverflow and the WATIN users email lists - it seems other people have had similar problems but I did not see any solutions.
We are using Teamcity, but we had similar problem with IE7. The origin of problem was opened IE. You already mention that you use Watin to close all open instances. But make sure that you use ie.ForceClose(); in TearDown and SetUp.
I had the same problem with WaitUntil. But it was only because the site was not trusted on the server and so didn't open so i get a time out.
Maybe you get the same problem...