断続的にブラウザー インスタンスにアタッチしようとすると、継続的インテグレーション ビルド プロセスの一部として実行される WatiN ステップが失敗します。現在5回に1回程度。
Browser.AttachTo<IE>(Find.ByTitle("Title of Popup"));
次のエラーが発生します。
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.IEWaitForComplete.WaitUntilNotNull(DoFunc`1 func, BuildTimeOutExceptionMessage exceptionMessage)
at WatiN.Core.Native.InternetExplorer.IEWaitForComplete.WaitWhileIEBusy(IWebBrowser2 ie)
at WatiN.Core.Native.InternetExplorer.IEWaitForComplete.WaitForCompleteOrTimeout()
at WatiN.Core.WaitForCompleteBase.DoWait()
at WatiN.Core.Native.InternetExplorer.AttachToIeHelper.FinishInitializationAndWaitForComplete(IE ie, SimpleTimer timer, Boolean waitForComplete)
at WatiN.Core.Native.InternetExplorer.AttachToIeHelper.Find(Constraint findBy, Int32 timeout, Boolean waitForComplete)
at WatiN.Core.Browser.AttachTo[T](Constraint constraint)
以前の投稿で提案された明らかなことをすべて実行しました。
つまり、WatiN ステップを実行する前に、すべての Internet Explorer プロセスを強制終了します。
Process.GetProcessesByName("IEXPLORE").ToList().ForEach(p => p.Kill());
WatiN ステップを実行する前に、タイムアウトを増やします。
var timeout = 60;
Settings.AttachToBrowserTimeOut = timeout;
Settings.WaitForCompleteTimeOut = timeout;
Settings.WaitUntilExistsTimeOut = timeout;
各 WatiN ステップは、次のコード ブロックでアクションとして渡されます。
public void UseAndCloseBrowser(Action<Browser> action, Browser browser)
{
try
{
action(browser);
browser.WaitForComplete();
}
finally
{
Log(Level.Info, "Attempting to close browser {0}", browser.Title);
browser.Close();
browser.Dispose();
}
}
この迷惑なエラーメッセージの最後にたどり着くために私ができること/確認できることを誰かが知っていますか?