private void DisposeAndCloseIE(bool closeIE) { if (isDisposed) { return; } Logger.LogDebug(Resources.IE_Dispose); if (closeIE && IsInternetExplorerStillAvailable()) { // Close all open HTMLDialogs HtmlDialogs.CloseAll(); } base.Dispose(true); if (closeIE && IsInternetExplorerStillAvailable()) { // Ask IE to close _ieBrowser.Quit(); } _ieBrowser = null; if (closeIE) { // Wait for IE to close to prevent RPC errors when creating // a new WatiN.Core.IE instance. Thread.Sleep(1000); } isDisposed = true; }
private HtmlDialog FindHtmlDialog(Constraint findBy, int timeout) { Logger.LogAction("Busy finding HTMLDialog matching criteria: " + findBy); var action = new TryFuncUntilTimeOut(timeout) { SleepTime = 500 }; var result = action.Try(() => HtmlDialogs.First(findBy)); if (result == null) { throw new HtmlDialogNotFoundException(findBy.ToString(), timeout); } return(result); }
private HtmlDialog FindHtmlDialog(Constraint findBy, int timeout) { Logger.LogAction((LogFunction log) => { log("Busy finding HTMLDialog matching criteria: {0}", findBy); }); var action = new TryFuncUntilTimeOut(TimeSpan.FromSeconds(timeout)) { SleepTime = TimeSpan.FromMilliseconds(500) }; var result = action.Try(() => HtmlDialogs.First(findBy)); if (result == null) { throw new HtmlDialogNotFoundException(findBy.ToString(), timeout); } return(result); }