自动填充gmail注册与webbrowser控件错误

时间:2012-07-05 08:08:08

标签: c# automation gmail browser

我使用webbrower为gmail注册表设置自动值,当我填写capcha并提交时,服务器给出消息“抱歉,我们此时无法为您的新帐户提供服务。”。我注册手册它的成功。你能解释一下为什么吗?

这是我的代码。

HtmlElement element = webBrowser1.Document.GetElementById("LastName");
        if (element != null) {
            string lastName = "LastName";
            element.InnerText = lastName; 
          }
        element = webBrowser1.Document.GetElementById("lastname-placeholder");
        if (element != null) { element.InnerText = ""; }

        // First Name
        element = webBrowser1.Document.GetElementById("firstname-placeholder");
        if (element != null)
        {
            element.InnerText = "";
        }
        element = webBrowser1.Document.GetElementById("FirstName");
        if (element != null) {
            string firstName = "firstName";
            element.InnerText = firstName;

            element.InvokeMember("onblur");
        }

        element = webBrowser1.Document.GetElementById("GmailAddress");
        if (element != null)
        {
            string account="abcxxx";// 

            element.InnerText = account;

            element.InvokeMember("onblur");
            element.InvokeMember("onChange");

            element.InvokeMember("onFocus");
        }
        // Password
        string password = "abc123xxx";
        element = webBrowser1.Document.GetElementById("Passwd");
        if (element != null) {
            element.InnerText = password;
            emailCreated.Password = password;

            element.InvokeMember("onFocus");
            element.InvokeMember("onblur"); element.InvokeMember("onChange");
        }

        element = webBrowser1.Document.GetElementById("PasswdAgain");
        if (element != null) { element.InnerText = password; element.InvokeMember("onFocus"); element.InvokeMember("onblur"); element.InvokeMember("onChange"); }

        // Day
        element = webBrowser1.Document.GetElementById("birthday-placeholder");
        if (element != null)
        {
            element.InnerText = "";
        }
        element = webBrowser1.Document.GetElementById("BirthDay");
        if (element != null) { element.InnerText = "14"; element.InvokeMember("onblur"); }

        // Month
        element = webBrowser1.Document.GetElementById("BirthMonth");
        if (element != null)
        {
            element.SetAttribute("SelectedIndex", "2"); element.InvokeMember("onblur");

        }
        element = webBrowser1.Document.GetElementById("HiddenBirthMonth");
        if (element != null)
        {
            element.InnerText = "02";
        }
        //Year
        element = webBrowser1.Document.GetElementById("birthYear-placeholder");
        if (element != null)
        {
            element.InnerText = "";
        }
        element = webBrowser1.Document.GetElementById("BirthYear");
        if (element != null) { element.InnerText = "1986"; element.InvokeMember("onblur"); }


        // Gender
        element = webBrowser1.Document.GetElementById("Gender");
        if (element != null) { element.SetAttribute("SelectedIndex", "1"); element.InvokeMember("onblur"); }
        element = webBrowser1.Document.GetElementById("HiddenGender");
        if (element != null) { element.InnerText = "FEMALE"; element.SetAttribute("value", "FEMALE"); element.InvokeMember("onblur"); }


        //RecoveryPhoneNumber
        element = webBrowser1.Document.GetElementById("RecoveryPhoneNumber");
        element.InnerText = txtMobileRecover.Text;


        element = webBrowser1.Document.GetElementById("RecoveryEmailAddress");
        element.InnerText="mailabcxxx@gmail.com"

        //TermsOfService
        element = webBrowser1.Document.GetElementById("TermsOfService");
        if (element != null) { element.SetAttribute("checked", "true"); element.InvokeMember("onblur"); }
        //HomepageSet
        element = webBrowser1.Document.GetElementById("HomepageSet");
        if (element != null) { element.SetAttribute("checked", ""); element.InvokeMember("onblur"); }
        // images

1 个答案:

答案 0 :(得分:0)

Recaptcha是js所以如果你从那个ip创建了几个帐户,你必须等待一段时间......

即使您清除包含flash cookie的cookie,您的IP也会被保存。

据我所知,如果您设法看到msg您的代码是正确的,并且您通过了所有客户端表单验证。该消息来自服务器,尝试在其他计算机上进行测试。