示例#1
0
        void Recorder_OnNavigateComplete(object pDisp, ref object URL)
        {
            //System.Diagnostics.Trace.WriteLine("Recorder_OnNavigateComplete");
            if (isRecorder)
            {
                if (UserBar.instance != null)
                {
                    //Get Web Browser
                    if (Recorder.HostInstance != null && Recorder.HostInstance.BrowserRef != null)
                    {
                        IWebBrowser2 ActiveBrowser = Recorder.HostInstance.BrowserRef as SHDocVw.IWebBrowser2;

                        if (ActiveBrowser != null)
                        {
                            if (isPerfRecorder)
                            {
                                string currUrl = "Browser ; " + BrowserActionEnum.Nav + ActiveBrowser.LocationURL + ";time cost:" + Convert.ToString(DateTime.Now - start);

                                StepRecorder.RecordStep(UserBar.instance.SteptreeView, currUrl);
                            }
                            //Record the URL
                            else
                            {
                                string currUrl = "Browser ; " + BrowserActionEnum.Nav + ActiveBrowser.LocationURL;

                                StepRecorder.RecordStep(UserBar.instance.SteptreeView, currUrl);
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        public void _click(IHTMLEventObj obj)
        {
            try
            {
                string identify = GetIdentify(obj.srcElement);

                identify += "; CLICK";

                StepRecorder.RecordStep(UserBar.instance.SteptreeView, identify);

                obj.srcElement.click();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public void _keyup(IHTMLEventObj obj)
        {
            //Keys currentKey = (Keys)Enum.Parse(typeof(Keys), obj.keyCode.ToString());

            IHTMLElement current = ((DispHTMLDocument)obj.srcElement.document).activeElement;

            //IHTMLDOMNode currentNode = ((IHTMLDOMNode)current);

            string identify = GetIdentify(obj.srcElement);

            if (CloneInputElement != null)
            {
                if (current == CloneInputElement) //same input
                {
                    StepRecorder.RecordStep(UserBar.instance.SteptreeView, identify + " ; APPEND ;" + (char)obj.keyCode);
                }
                else
                {
                    CloneInputElement = current;
                    StepRecorder.RecordStep(UserBar.instance.SteptreeView, identify + " ; INPUT ;" + current.getAttribute(Finder.valueAttribute, 0));
                }
            }
            else
            {
                CloneInputElement = current;
                StepRecorder.RecordStep(UserBar.instance.SteptreeView, identify + " ; INPUT ;" + current.getAttribute(Finder.valueAttribute, 0));
            }

            //switch (currentKey)
            //{
            //    case Keys.Enter:
            //        break;
            //    default:
            //        break;

            //}
            //string identify = GetIdentify(obj.srcElement);

            //identify += "action : keyinput ; value :"+obj.keyCode ;
        }
示例#4
0
        void Recorder_OnDocumentComplete2(object pDisp, ref object url)
        {
            //Mouse Hook use the Dom Event
            //System.Diagnostics.Trace.WriteLine("Recorder_OnDocumentComplete2");
            if (isRecorder)
            {
                if (UserBar.instance != null)
                {
                    //Get Web Browser
                    if (Recorder.HostInstance != null && Recorder.HostInstance.BrowserRef != null)
                    {
                        IWebBrowser2 ActiveBrowser = Recorder.HostInstance.BrowserRef as SHDocVw.IWebBrowser2;


                        if (ActiveBrowser != null)
                        {
                            if (((IWebBrowser2)pDisp) == ActiveBrowser)
                            {
                                //Get the current document
                                IHTMLDocument2 htmlDoc = (IHTMLDocument2)ActiveBrowser.Document;

                                DispHTMLDocument doc = (DispHTMLDocument)htmlDoc;

                                //Record the basic Url
                                string address = ActiveBrowser.LocationURL;

                                string host = string.Empty;
                                ParseUrl(address, out host);
                                //fetch all of the image, css etc
                                HTMLStyleSheetsCollection styles = htmlDoc.styleSheets;
                                foreach (IHTMLStyleSheet style in styles)
                                {
                                    //Get Size
                                    int content;
                                    GetWebContentSize(host + style.href, out content);
                                    StepRecorder.RecordStep(UserBar.instance.SteptreeView, style.href + " size:" + content);
                                }

                                IHTMLElementCollection scripts = htmlDoc.scripts;
                                foreach (IHTMLScriptElement script in scripts)
                                {
                                    int content;
                                    GetWebContentSize(host + script.src, out content);
                                    StepRecorder.RecordStep(UserBar.instance.SteptreeView, script.src + " size:" + content);
                                }
                                //IHTMLElementCollection imgs = doc.images;
                                //foreach (IHTMLElement img in imgs)
                                //{
                                //    StepRecorder.RecordStep(UserBar.instance.SteptreeView, img.);
                                //}

                                IHTMLWindow2 win = htmlDoc.parentWindow;



                                if (htmlDoc != null)
                                {
                                    _BindDomEvent(doc);
                                }
                            }
                        }
                    }
                }
            }
            //record the load time
        }