cotopboy
9/2/2013 - 8:11 AM

C# webbrowser

C# webbrowser

 private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            //HtmlElement btnSubmit = webBrowser.Document.All["logonForm"];
            HtmlElement tbUserid = webBrowser.Document.All["username"];
            HtmlElement tbPasswd = webBrowser.Document.All["pwd"];

            //if (tbUserid == null || tbPasswd == null )
            //    return;

            tbUserid.SetAttribute("value", "123456789");
            tbPasswd.SetAttribute("value", "123456789");

            //  HtmlElement formLogin = webBrowser.Document.Forms["logonForm"];
            //  formLogin.InvokeMember("submit");
            SendKeys.Send("{TAB}");
            SendKeys.Flush();
            SendKeys.Send("{ENTER}");
            SendKeys.Flush();
        }