예제 #1
0
        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;
        }
예제 #2
0
파일: IE.cs 프로젝트: minskowl/MY
        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);
        }
예제 #3
0
        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);
        }