Bước WatiN chạy trong quá trình tạo tích hợp liên tục không thành công trong khi cố gắng đính kèm vào một phiên bản trình duyệt không liên tục. Hiện tại khoảng 1 trong 5 lần.Browser.AttachTo <T>() gây ra ngoại lệ gián đoạn "Thời gian chờ trong khi Internet Explorer bận"
Browser.AttachTo<IE>(Find.ByTitle("Title of Popup"));
Với lỗi sau:
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)
Tôi đã làm tất cả những điều hiển nhiên mà đã được đề xuất trong bài viết theo thời gian:
Tức là Giết tất cả các quá trình internet explorer trước khi chạy một bước WatiN:
Process.GetProcessesByName("IEXPLORE").ToList().ForEach(p => p.Kill());
Tăng timeout trước khi chạy bất kỳ bước WatiN:
var timeout = 60;
Settings.AttachToBrowserTimeOut = timeout;
Settings.WaitForCompleteTimeOut = timeout;
Settings.WaitUntilExistsTimeOut = timeout;
Mỗi bước WatiN được thông qua tại như một hành động trong khối mã sau:
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();
}
}
Có ai biết điều gì khác mà tôi có thể làm/kiểm tra để đến cuối thông báo lỗi gây phiền nhiễu này không?
Bối cảnh chạy WatiN là gì? Ví dụ, nó có chạy trong dịch vụ Windows CruiseControl.NET không? Tôi đã có rất nhiều vấn đề với WatiN đang chạy từ bên trong các dịch vụ Windows vì các dịch vụ Windows là các ứng dụng không cửa sổ. – NathanAldenSr
Xin chào, xin lỗi tôi đã không liên hệ lại với bạn sớm hơn .. Đó là đại lý là dịch vụ cửa sổ và đang chạy bằng tên người dùng của tôi. Vì vậy, có toàn quyền truy cập internet explorer vv Tất cả mọi thứ hoạt động ngoại trừ đính kèm, mà như tôi đã nói là không liên tục. – CraftyFella