Beispiel #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);
                        });
                    };
                }
            }
        }
Beispiel #2
0
        public void OnCommandRecording(string command, string target = "", string value = "")
        {
            Log.Logger.DebugFormat("command = {0}, {1}, {2}", command, target, value);

            if (false == this.IsRecording)
            {
                return;
            }

            if (null == this.CommandRecording)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(command))
            {
                throw new ArgumentNullException("command");
            }

            SynchronizationDispatcher.Invoke(() =>
            {
                this.CommandRecording(this, new CommandRecorderEventArgs(command, target, value));
            });
        }