Esempio n. 1
0
        private void AttachBrowser()
        {
            lock (this.syncObj)
            {
                foreach (InternetExplorer ie in IE.FindAll())
                {
                    if (this.browserList.Contains(ie))
                    {
                        continue;
                    }

                    this.AttachWindow(((IHTMLDocument2)ie.Document).parentWindow);

                    ie.DocumentComplete += delegate(object disp, ref object url)
                    {
                        if (false == this.IsRecording)
                        {
                            return;
                        }

                        IHTMLDocument2 doc = ie.Document;
                        Uri            u   = new Uri(doc.url);

                        SynchronizationDispatcher.Invoke(() =>
                        {
                            do
                            {
                                Thread.Sleep(500);
                            }while (!IE.IsReadyStateComplete(ie));

                            //this.OnCommandRecording("assertTitle", doc.title);
                            //this.OnCommandRecording("assertLocation", u.AbsolutePath);
                            this.AttachWindow(((IHTMLDocument2)ie.Document).parentWindow);
                        });
                    };
                }
            }
        }