示例#1
0
        private void tsmiGetImage_Click(object sender, EventArgs e)
        {
            Image img = WebAutomationHelper.GetRegCodePic(webBrowser1, currentElement);

            objFrmShowImage.picbSource.Image = img;
            objFrmShowImage.Show();
        }
示例#2
0
 protected override void Do(IEvent e)
 {
     if (e.Data.Count < 1)
     {
         return;
     }
     SelectRadioTask.Execute(WebAutomationHelper.ParseElementByXPath(e.Webbrowser.Document.Body, e.Data[0]));
 }
示例#3
0
 protected override void Do(IEvent e)
 {
     if (e.Data.Count < 2)
     {
         return;
     }
     FillDataTask.Execute(WebAutomationHelper.FindControlByID(e.Webbrowser, e.Data[0]), e.Data[1]);
 }
示例#4
0
 protected override void Do(IEvent e)
 {
     if (e.Data.Count < 2)
     {
         return;
     }
     FillDataTask.Execute(WebAutomationHelper.ParseElementByXPath(e.Webbrowser.Document.Body, e.Data[0]), e.Data[1]);
 }
示例#5
0
 protected override void Do(IEvent e)
 {
     if (e.Data.Count < 1)
     {
         return;
     }
     ClickButtonTask.Execute(e.Webbrowser, WebAutomationHelper.FindControlByID(e.Webbrowser, e.Data[0]));
 }
示例#6
0
        /// <summary>
        /// 解析当前Xpath元素
        /// </summary>
        /// <returns></returns>
        private HtmlElement ParseCurrentXPath()
        {
            // GetHtmlNodeByXPath
            string path = "";

            path = WebAutomationHelper.GetElementXPath(currentElement);
            // MessageBox.Show(path);

            HtmlElement elem = WebAutomationHelper.ParseElementByXPath(webBrowser1.Document.Body, path);

            // MessageBox.Show(elem.OuterHtml);
            return(elem);
        }
示例#7
0
        private void tsbTaskScriptGetPic_Click(object sender, EventArgs e)
        {
            //ExcuteJs(GetRandImg,);

            //Image img = WebAutomationHelper.GetRegCodePic(webBrowser1, objFrmInputImgInfo.ReturnIdNameValue, objFrmInputImgInfo.ReturnSrcValue, objFrmInputImgInfo.ReturnAltValue);
            //objFrmShowImage.picbSource.Image = img;
            //objFrmShowImage.Show();

            HtmlElement elem = WebAutomationHelper.ParseElementByXPath(webBrowser1.Document.Body, "HTML/BODY/FORM/DIV[3]/DIV[2]/DIV/DIV/DIV[2]/TABLE/TBODY/TR[7]/TD[2]/IMG");

            Image img = WebAutomationHelper.GetRegCodePic(webBrowser1, elem);

            objFrmShowImage.picbSource.Image = img;
            objFrmShowImage.Show();
        }
示例#8
0
        void Document_MouseOver(object sender, HtmlElementEventArgs e)
        {
            currentElement = webBrowser1.Document.GetElementFromPoint(e.ClientMousePosition);
            if (canDrawSelected == true)
            {
                Point p       = WebAutomationHelper.GetOffset(currentElement);
                Point pClient = currentElement.OffsetRectangle.Location;
                int   width   = currentElement.OffsetRectangle.Width;
                int   height  = currentElement.OffsetRectangle.Height;
                // 画框
                Graphics g = Graphics.FromHwnd(m_hwnd);
                // g.DrawRectangle(m_browserPen, m_elemRect);
                elemRect = new Rectangle(pClient.X, pClient.Y, width, height);
                g.DrawRectangle(m_browserPen, p.X, p.Y, width, height);
                g.Dispose();
                rtxtConsoleText.Text += (pClient.X + "," + pClient.Y + "," + width + "," + height) + "\n";
                rtxtConsoleText.Select(rtxtSourceCode.TextLength, 0);
                rtxtConsoleText.ScrollToCaret();
            }



            string      path = "";
            HtmlElement elem = webBrowser1.Document.GetElementFromPoint(e.ClientMousePosition);

            path = WebAutomationHelper.GetElementXPath(elem);
            txtElementXPath.Text = path;
            currentElementXPath  = path;
            InvokeHelper.Set(txtElementXPath, "Text", path);

            System.Threading.Thread.Sleep(200);
            //IHTMLDocument2 document = (IHTMLDocument2)webBrowser1.Document.DomDocument;
            //IHTMLControlElement htmlElem = (IHTMLControlElement)document.onmousemove;
            //txtElementCode.Text = IceFormater.ConvertToXml(elem.OuterHtml, true);
            InvokeHelper.Set(txtElementCode, "Text", HtmlCodeFormat.Format(elem.OuterHtml));
        }