126邮箱注册

        private void DocumentCompleted_Handler(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (webBrowser1.ReadyState == WebBrowserReadyState.Interactive)//判断ReadyState状态 防止多次刷新信息
            {
                doc = webBrowser1.Document;
                if (doc.Body.InnerText.IndexOf("注册字母邮箱") > 0)
                {
                    doc.GetElementById("tabsUl").Document.GetElementsByTagName("li")[0].FirstChild.InvokeMember("onclick");//默认选中字母邮箱注册选项
                    doc.GetElementById("nameIpt").Focus();
                    name = GetRandomStr_char(1, true) + GetRandomStr(17, true);
                    doc.GetElementById("nameIpt").InnerText = name;//首位必须是字母
                    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();
                }
            }
            else
            {
                if (doc.Body.InnerText.IndexOf("您的注册信息正在处理中...") > 0)
                {
                    //申请太频繁ip被封
                    return;
                }
                if (doc.Body.InnerText.IndexOf("注册成功") > 0)
                {
                   //插入数据库
                }
            }
        }

 

有时点击提交按钮但是数据提交不了 页面不出现跳转   有可能是没有调用focus()方法 没有触发邮箱的 注册信息验证  未通过验证 所以提交不了数据

目前只能实现 半自动 申请  验证码要自己手动输入审核

posted on 2013-07-05 16:17  酒歌  阅读(969)  评论(0编辑  收藏  举报