c#申请126邮箱 有时提交不了

 private void DocumentCompleted_Handler(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            HtmlDocument doc;
            doc = webBrowser1.Document;
            if (doc.Body.InnerText.IndexOf("注册字母邮箱") > 0)
            {
                System.Threading.Thread.Sleep(1000);
                Application.DoEvents();
                doc.GetElementById("nameIpt").Focus();
                doc.GetElementById("nameIpt").InnerText =GetRandomStr_char(1,true)+ GetRandomStr(17, true);//首位必须是字母
                string pwd = GetRandomStr(16, true);
                doc.GetElementById("mainPwdIpt").Focus();
                doc.GetElementById("mainPwdIpt").InnerText = pwd;
                doc.GetElementById("mainCfmPwdIpt").Focus();
                doc.GetElementById("mainCfmPwdIpt").InnerText = pwd;
                doc.GetElementById("mainRegA").Focus();
            }
        }

有很多时候经常忘记调用 focus()方法  致使 动态给用户名、密码、确认密码 赋值时 未触发 126邮箱申请的 各种验证(用户名验证、密码验证、确认密码验证)  从而导致提交不了 点击提交按钮没有反应

posted on 2013-07-03 17:13  酒歌  阅读(355)  评论(0编辑  收藏  举报