コード例 #1
0
        public static async Task SetValueSlow(this DOMInputElement inputElement, Browser browser, string val, bool clear = false)
        {
            inputElement.Focus();

            await Task.Delay(100);

            inputElement.Click();
            await Task.Delay(100);


            foreach (char c in val)
            {
                var param = new KeyParams(VirtualKeyCode.VK_E, c);

                if (c.ToString() == " ")
                {
                    param = new KeyParams(VirtualKeyCode.SPACE, ' ');
                }


                browser.KeyDown(param);
                browser.KeyUp(param);
                await Task.Delay(100);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: neoelan/geotag
 void LoadCoordsGmap()
 {
     try
     {
         ManualResetEvent waitEvent = new ManualResetEvent(false);
         winFormsBrowserView2.FinishLoadingFrameEvent += delegate(object sender, FinishLoadingEventArgs e)
         {
             // Wait until main document of the web page is loaded completely.
             if (e.IsMainFrame)
             {
                 if (this.tbCoords.Text != null)
                 {
                     waitEvent.Set();
                     DOMDocument     document   = winFormsBrowserView2.Browser.GetDocument();
                     DOMInputElement searchgmap = (DOMInputElement)document.GetElementById("searchboxinput");
                     searchgmap.Value = tbCoords.Text;
                     searchgmap.Click();
                     DOMElement searchbutton = document.GetElementById("searchbox-searchbutton");
                     searchbutton.Click();
                 }
             }
         };
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #3
0
        public static async Task SetValue(this DOMInputElement inputElement, Browser browser, string val, bool clear = false)
        {
            inputElement.Focus();
            inputElement.Click();

            if (clear)
            {
                for (int i = 0; i < 100; i++) //CLEAR
                {
                    var param = new KeyParams(VirtualKeyCode.BACK, (char)8);
                    browser.KeyDown(param);
                    browser.KeyUp(param);

                    await Task.Delay(2);
                }

                await Task.Delay(1);
            }

            foreach (char c in val)
            {
                var param = new KeyParams(VirtualKeyCode.VK_E, c);

                if (c.ToString() == " ")
                {
                    param = new KeyParams(VirtualKeyCode.SPACE, ' ');
                }


                browser.KeyDown(param);
                browser.KeyUp(param);
                await Task.Delay(10);
            }
        }