コード例 #1
0
        public WatiN_IE createIEObject(string url, int top, int left, int width, int height)
        {
            IEThread = O2Thread.staThread(
                () => {
                "launching a new WatIN InternetExplorer Process".info();
                try
                {
                    if (url.valid().isFalse())
                    {
                        url = "about:blank";
                    }
                    Settings.MakeNewIeInstanceVisible = false;
                    IE = new IE(url);
                    InternetExplorer         = (InternetExplorerClass)IE.InternetExplorer;
                    InternetExplorer.Top     = top;
                    InternetExplorer.Left    = left;
                    InternetExplorer.Width   = width;
                    InternetExplorer.Height  = height;
                    InternetExplorer.Visible = true;

                    InternetExplorer.OnQuit += close;
                    WaitForIELaunch.Set();
                    WaitForIEClose.WaitOne();
                }
                catch (Exception ex)
                {
                    ex.log("in WatiN_IE createIEObject");
                    WaitForIELaunch.Set();
                    WaitForIEClose.Set();
                }
            });
            WaitForIELaunch.WaitOne();
            return(this);
        }
コード例 #2
0
        public WatiN_IE attachTo(InternetExplorer ieInstanceToAttach)
        {
            IEThread = O2Thread.staThread(
                () => {
                try
                {
                    //WatiN.Core.Settings.AutoStartDialogWatcher = false;

                    WaitForIEClose.Reset();
                    "attaching to IE with LocationName '{0}'".info(ieInstanceToAttach.LocationName);

                    IE = new IE(ieInstanceToAttach);

                    //this doesn't work on external processes attach
                    //InternetExplorer = (SHDocVw.InternetExplorerClass)IE.InternetExplorer;

                    (ieInstanceToAttach as DWebBrowserEvents2_Event).OnQuit +=
                        () =>
                    {
                        //"ON WatiN_IE attachTo Quit EVENT".debug();
                        close();
                    };

                    WaitForIELaunch.Set();

                    WaitForIEClose.WaitOne();
                    //"AFTER WaitForIEClose".error();
                }
                catch (Exception ex)
                {
                    ex.log("in attachTo(InternetExplorer)", true);
                    WaitForIELaunch.Set();
                    WaitForIEClose.Set();
                }
            });
            //"before WaitForIELaunch".error();
            WaitForIELaunch.WaitOne();
            //"after WaitForIELaunch".error();
            return(this);
        }
コード例 #3
0
 public void detach()
 {
     WaitForIEClose.Set();
 }