Exemple #1
0
        public bool parseUserAction(ref IRecordEvent e)
        {
            if (e.UIElement == null)
            {
                return(false);
            }
            if (e.UIElement.ProcessId < 1)
            {
                return(false);
            }
            var p = System.Diagnostics.Process.GetProcessById(e.UIElement.ProcessId);

            if (p.ProcessName != "iexplore" && p.ProcessName != "iexplore.exe")
            {
                return(false);
            }

            var browser = new Browser(e.UIElement.RawElement);


            var htmlelement = browser.ElementFromPoint(e.X, e.Y);

            if (htmlelement == null)
            {
                return(false);
            }

            var selector = new IESelector(browser, htmlelement, null, true, e.X, e.Y);

            e.Selector = selector;
            e.Element  = new IEElement(browser, htmlelement);

            var a = new GetElement {
                DisplayName = (htmlelement.id + "-" + htmlelement.tagName + "-" + htmlelement.className).Replace(Environment.NewLine, "").Trim()
            };

            a.Selector = selector.ToString();
            a.Image    = selector.Last().Element.ImageString();
            var last = selector.Last() as IESelectorItem;


            var tagName = last.tagName;

            if (string.IsNullOrEmpty(tagName))
            {
                tagName = "";
            }
            tagName = tagName.ToLower();
            e.a     = new GetElementResult(a);
            if (tagName == "input")
            {
                // MSHTML.IHTMLInputElement inputelement = (MSHTML.IHTMLInputElement)htmlelement;
                e.SupportInput = (last.type.ToLower() == "text" || last.type.ToLower() == "password");
            }

            return(true);
        }
Exemple #2
0
        private void OnMouseUp(InputEventArgs e)
        {
            var thread = new Thread(new ThreadStart(() =>
            {
                Log.Debug(string.Format("IE.Recording::OnMouseUp::begin"));
                var re = new RecordEvent(); re.Button = e.Button;
                var a  = new GetElement {
                    DisplayName = e.Element.Id + "-" + e.Element.Name
                };

                var browser     = new Browser(e.Element.rawElement);
                var htmlelement = browser.ElementFromPoint(e.X, e.Y);
                if (htmlelement == null)
                {
                    return;
                }

                var sw = new System.Diagnostics.Stopwatch();
                sw.Start();
                IESelector sel = null;
                // sel = new IESelector(e.Element.rawElement, null, true);
                sel = new IESelector(htmlelement, null, browser.Document, false);
                if (sel == null)
                {
                    return;
                }
                if (sel.Count < 2)
                {
                    return;
                }
                a.Selector   = sel.ToString();
                re.UIElement = e.Element;
                re.Element   = new IEElement(htmlelement);
                re.Selector  = sel;
                re.X         = e.X;
                re.Y         = e.Y;

                Log.Debug(e.Element.SupportInput + " / " + e.Element.ControlType);
                re.a = new GetElementResult(a);
                if (htmlelement.tagName.ToLower() == "input")
                {
                    mshtml.IHTMLInputElement inputelement = (mshtml.IHTMLInputElement)htmlelement;
                    re.SupportInput = (inputelement.type.ToLower() == "text" || inputelement.type.ToLower() == "password");
                }

                Log.Debug(string.Format("IE.Recording::OnMouseUp::end {0:mm\\:ss\\.fff}", sw.Elapsed));
                OnUserAction?.Invoke(this, re);
            }));

            thread.IsBackground = true;
            thread.Start();
        }
Exemple #3
0
        public bool parseUserAction(ref IRecordEvent e)
        {
            if (e.UIElement == null)
            {
                return(false);
            }
            if (e.UIElement.ProcessId < 1)
            {
                return(false);
            }
            var p = System.Diagnostics.Process.GetProcessById(e.UIElement.ProcessId);

            if (p.ProcessName != "iexplore" && p.ProcessName != "iexplore.exe")
            {
                return(false);
            }

            var browser = new Browser(e.UIElement.rawElement);


            var htmlelement = browser.ElementFromPoint(e.X, e.Y);

            if (htmlelement == null)
            {
                return(false);
            }

            var selector = new IESelector(htmlelement, null, browser.Document, false);

            var a = new GetElement {
                DisplayName = htmlelement.id + "-" + htmlelement.tagName + "-" + htmlelement.className
            };

            a.Selector = selector.ToString();


            var tagName = htmlelement.tagName;

            if (string.IsNullOrEmpty(tagName))
            {
                tagName = "";
            }
            tagName = tagName.ToLower();
            e.a     = new GetElementResult(a);
            if (tagName == "input")
            {
                mshtml.IHTMLInputElement inputelement = (mshtml.IHTMLInputElement)htmlelement;
                e.SupportInput = (inputelement.type.ToLower() == "text" || inputelement.type.ToLower() == "password");
            }

            return(true);
        }