public void ProtonMail(object i) { IWebDriver driver = Untils.FireFoxDriver(); driver.Manage().Cookies.DeleteAllCookies(); try { string Accountmail = Untils.getRandString(12); string recovermail = Untils.getRandString(12) + "@163.com"; string Accountname = Untils.getRandStringAll(8); string Password = Untils.ranpass(); driver.Manage().Window.Size = new Size(1000, 1200); driver.Navigate().GoToUrl("https://mail.protonmail.com/create/new?language=en"); WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, 8000)); wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("password"))); //密码和确认密码 driver.FindElement(By.Id("password")).SendKeys(Password); driver.FindElement(By.Id("passwordc")).SendKeys(Password); driver.SwitchTo().Frame(1); wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("username"))); //用户名 driver.FindElement(By.Id("username")).SendKeys(Accountmail); driver.SwitchTo().DefaultContent(); driver.SwitchTo().Frame(0); //恢复邮箱 driver.FindElement(By.Id("notificationEmail")).SendKeys(recovermail); driver.FindElement(By.Name("submitBtn")).Click(); //wait.Until(ExpectedConditions.ElementIsVisible(By.Id("pm_loading")));//*[@id="id-signup-radio-email"] //Thread.Sleep(2000); //MessageBox.Show("1"); //driver.FindElement(By.XPath("//*[@id=\"id-signup-radio-email\"]")).Click(); wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("pm_loading"))); Sqlite.InsertValues("ProtonTable", new string[] { dgv_pro.Rows.Count.ToString(), Accountmail, Accountname, Password, DateTime.Now.ToString() }); ReFreshAll(); driver.Quit(); } catch (Exception ex) { driver.Quit(); MessageBox.Show(ex.Message); xlog(ex.Message); } }
public void EAsignuptemp(string temail) { IWebDriver driver = Untils.FireFoxDriver(); driver.Manage().Cookies.DeleteAllCookies(); string name = Untils.getRandStringAll(8); //账户名 string Password = Untils.ranpass(); //密码 try { driver.Manage().Window.Size = new Size(800, 900); String url = String.Format("https://signin.ea.com/p/originX/create?execution=e1{0}s6&initref=https%3A%2F%2Faccounts.ea.com%3A443%2Fconnect%2Fauth%3Fresponse_type%3Dcode%26client_id%3DORIGIN_SPA_ID%26display%3DoriginXWeb%252Fcreate", random.Next(10000, 99999).ToString()); driver.Navigate().GoToUrl(url); WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, 8000)); //driver.ExecuteJavaScript(Properties.Resources.EASignup); //wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("clientreg_country-selctrl"))); wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(("//*[@id=\"clientreg_dobmonth-selctrl\"]/option[12]")))); Thread.Sleep(500); //地区 optionclick(driver, "//*[@id=\"clientreg_country-selctrl\"]", random.Next(1, 100).ToString()); //driver.FindElement(By.XPath(String.Format(xpath + "/option[{0}]", num))).Click(); //日期 optionclick(driver, "//*[@id=\"clientreg_dobyear-selctrl\"]", random.Next(20, 100).ToString()); optionclick(driver, "//*[@id=\"clientreg_dobmonth-selctrl\"]", random.Next(1, 12).ToString()); optionclick(driver, "//*[@id=\"clientreg_dobday-selctrl\"]", random.Next(1, 30).ToString()); Thread.Sleep(1000); var btn = driver.FindElement(By.Id("alternativeContent")); driver.ExecuteJavaScript("arguments[0].click();", btn); Thread.Sleep(1500); driver.FindElement(By.Id("countryDobNextBtn")).Click(); wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.Id("email"))); Thread.Sleep(500); //邮箱 driver.FindElement(By.Id("email")).SendKeys(temail); //密码 driver.FindElement(By.Id("password")).SendKeys(Password); //账号名 driver.FindElement(By.Id("originId")).SendKeys(name); Thread.Sleep(1000); driver.FindElement(By.Id("basicInfoNextBtn")).Click(); //安全问题 wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(("//*[@id=\"securityQuestion\"]/option[8]")))); Thread.Sleep(500); optionclick(driver, "//*[@id=\"securityQuestion\"]", random.Next(1, 8).ToString()); driver.FindElement(By.XPath("//*[@id=\"securityAnswer\"]")).SendKeys(name); Thread.Sleep(1000); driver.FindElement(By.Id("submitBtn")).Click(); wait.Until(ExpectedConditions.ElementToBeClickable(By.Id(("continueDoneBtn")))); Sqlite.InsertValues("EATable", new string[] { dgv_EA.Rows.Count.ToString(), temail, name, Password, Untils.GetNetworkTime().ToString() });//插入数据到数据库中 //Sqlite.DeleteValuesOR("OutTable", new string[] { "Email", "Name" }, new string[] { temail, name }); ReFreshAll(); driver.Quit(); driver.Close(); } catch (Exception ex) { driver.Quit(); //MessageBox.Show(ex.Message); xlog(ex.Message); } }
public void OutlookSignup(object i) { IWebDriver driver = Untils.FireFoxDriver(); driver.Manage().Cookies.DeleteAllCookies(); try { string Accountmail = Untils.getRandString(12) + "@outlook.com"; // "@outlook.com";;//邮箱 string Accountname = Untils.getRandStringAll(8); //账户名 string Password = Untils.ranpass(); //密码 driver.Manage().Window.Size = new Size(1000, 700); driver.Navigate().GoToUrl("https://signup.live.com/signup?"); WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, 8000)); //账号 wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id=\"MemberName\"]"))); driver.FindElement(By.XPath("//*[@id=\"MemberName\"]")).SendKeys(Accountmail); driver.FindElement(By.XPath("//*[@id=\"iSignupAction\"]")).Click(); //密码 wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id=\"PasswordInput\"]"))); driver.FindElement(By.XPath("//*[@id=\"PasswordInput\"]")).SendKeys(Password); driver.FindElement(By.XPath("//*[@id=\"iSignupAction\"]")).Click(); //名字 wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id=\"LastName\"]"))); driver.FindElement(By.XPath("//*[@id=\"LastName\"]")).SendKeys(Accountname); driver.FindElement(By.XPath("//*[@id=\"FirstName\"]")).SendKeys(Untils.getRandStringAll(8)); driver.FindElement(By.XPath("//*[@id=\"iSignupAction\"]")).Click(); //地区 wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id=\"Country\"]"))); driver.FindElement(By.XPath("//*[@id=\"Country\"]")).SendKeys(random.Next(1, 80).ToString()); var birthy = driver.FindElement(By.XPath("//*[@id=\"BirthYear\"]")); while (birthy.GetAttribute("value") == String.Empty) { birthy.SendKeys("19" + random.Next(20, 80).ToString()); Thread.Sleep(50); } var birthm = driver.FindElement(By.XPath("//*[@id=\"BirthMonth\"]")); while (birthm.GetAttribute("value") == String.Empty) { birthm.SendKeys(random.Next(1, 12).ToString()); Thread.Sleep(50); } var birthd = driver.FindElement(By.XPath("//*[@id=\"BirthDay\"]")); while (birthd.GetAttribute("value") == String.Empty) { birthd.SendKeys(random.Next(1, 30).ToString()); Thread.Sleep(50); } driver.FindElement(By.XPath("//*[@id=\"iSignupAction\"]")).Click(); wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id=\"mectrl_headerPicture\"]"))); Sqlite.InsertValues("OutTable", new string[] { dgv_OL.Rows.Count.ToString(), Accountmail, Accountname, Password, DateTime.Now.ToString() });//插入数据到数据库中 ReFreshAll(); driver.Quit(); driver.Close(); } catch (Exception ex) { driver.Quit(); //MessageBox.Show(ex.Message); xlog(ex.Message); } }