private void GenerateButton_Click(object sender, EventArgs e) { if (webBrowser1.ReadyState == WebBrowserReadyState.Complete) { try { Mail = webBrowser2.Document.GetElementById("userName").GetAttribute("value"); //Domain = webBrowser2.Document.GetElementById("domainName").GetAttribute("selected value"); HtmlElement SelectedValue = webBrowser2.Document.GetElementById("domainName"); foreach (HtmlElement child in SelectedValue.All) { if (child.GetAttribute("tagName").Equals("OPTION") && child.GetAttribute("selected").Equals("True")) { Domain = child.GetAttribute("text"); break; } } MailUser = Mail + Domain; webBrowser1.Document.GetElementById("account_loginNameFieldInput").SetAttribute("value", MailUser); webBrowser1.Document.GetElementById("dayDropDown").SetAttribute("value", Randomizer.RandomNumber(1, 0x1f).ToString()); webBrowser1.Document.GetElementById("monthDropDown").SetAttribute("value", Randomizer.RandomNumber(1, 12).ToString()); webBrowser1.Document.GetElementById("yearDropDown").SetAttribute("value", Randomizer.RandomNumber(0x79e, 0x7ca).ToString()); webBrowser1.Document.GetElementById("regInput_Country").SetAttribute("value", "FR"); webBrowser1.Document.GetElementById("account_loginNameFieldInput").SetAttribute("value", MailUser); foreach (HtmlElement element in webBrowser1.Document.GetElementsByTagName("input")) { if (((element.GetAttribute("name") != string.Empty) && (element.GetAttribute("name").Length != 0)) && (element.GetAttribute("name") == "account.password")) { element.SetAttribute("value", PasswordTxt.Text); } } webBrowser1.Document.GetElementById("confirmPasswordField").SetAttribute("value", PasswordTxt.Text); object[] args = new object[] { MailUser, "account_loginNameFieldInput", PasswordTxt.Text, "account_password" }; webBrowser1.Document.InvokeScript("validatePasswordAJAX", args); if (UsernameTxt.Text.Equals(String.Empty)) { MessageBox.Show("Username Empty", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else if (PasswordTxt.Text.Equals(String.Empty)) { MessageBox.Show("Password Empty", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else if (PasswordTxt.Lenght() < 8) { MessageBox.Show("Password lenght minimum is 8", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { webBrowser1.Document.GetElementById("createAccountButton").InvokeMember("click"); OutlogTxt.AppendText(DateTime.Now.ToString() + " : Processing Step 1... Please Wait...", Color.DimGray); } } catch (Exception ex) { //MessageBox.Show(ex.ToString()); OutlogTxt.AppendText(DateTime.Now.ToString() + " : Error with Sony Website or GeneratorWebsite, Please wait few minutes and try again.", Color.Red); } } Waitil(5); if (Errors[0] != null) { OutlogTxt.AppendText(Errors[0], Color.Red); } else if (Errors[1] != null) { OutlogTxt.AppendText(Errors[1], Color.Red); } else if (Errors[2] != null) { OutlogTxt.AppendText(Errors[2], Color.Red); } else if (Errors[3] != null) { OutlogTxt.AppendText(Errors[3], Color.Red); } }