Beispiel #1
0
        public void EAsignup(string email, string name, string Password)
        {
            IWebDriver driver = Untils.FireFoxDriver();

            driver.Manage().Cookies.DeleteAllCookies();
            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.ElementExists(By.XPath("//*[@id=\"clientreg_country-selctrl\"]")));
                //地区
                optionclick(driver, "//*[@id=\"clientreg_country-selctrl\"]", random.Next(1, 100).ToString());
                //webselect(driver, "//*[@id=\"clientreg_country-selctrl\"]", getRandStringAll(2, 0));
                //日期
                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(502222);
                var btn = driver.FindElement(By.XPath("//*[@id=\"alternativeContent\"]"));
                driver.ExecuteJavaScript("arguments[0].click();", btn);
                driver.FindElement(By.XPath("//*[@id=\"countryDobNextBtn\"]")).Click();
                wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id=\"email\"]")));
                //Thread.Sleep(1000);
                //邮箱
                driver.FindElement(By.XPath("//*[@id=\"email\"]")).SendKeys(email);
                //密码
                driver.FindElement(By.XPath("//*[@id=\"password\"]")).SendKeys(Password);
                //账号名
                driver.FindElement(By.XPath("//*[@id=\"originId\"]")).SendKeys(name);

                driver.FindElement(By.XPath("//*[@id=\"basicInfoNextBtn\"]")).Click();
                //wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(("//*[@id=\"home_children_button\"]"))));
                //driver.FindElement(By.XPath("//*[@id=\"home_children_button\"]")).Click();
                //图片验证结束//*[@id="victoryScreen"]
                //wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(("//*[@id=\"securityQuestion\"]"))));
                //driver.FindElement(By.XPath("//*[@id=\"basicInfoNextBtn\"]")).Click();
                //安全问题
                wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(("//*[@id=\"securityQuestion\"]/option[5]"))));
                optionclick(driver, "//*[@id=\"securityQuestion\"]", random.Next(1, 8).ToString());
                driver.FindElement(By.XPath("//*[@id=\"securityAnswer\"]")).SendKeys(name);
                driver.FindElement(By.XPath("//*[@id=\"submitBtn\"]")).Click();

                wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath(("//*[@id=\"continueDoneBtn\"]"))));
                Sqlite.InsertValues("EATable", new string[] { dgv_EA.Rows.Count.ToString(), email, name, Password, Untils.GetNetworkTime().ToString() });//插入数据到数据库中
                Sqlite.DeleteValuesOR("OutTable", new string[] { "Email", "Name" }, new string[] { email, name });
                ReFreshAll();
                driver.Quit();
                driver.Close();
            }
            catch (Exception ex)
            {
                driver.Quit();
                //MessageBox.Show(ex.Message);
                xlog(ex.Message);
            }
        }
Beispiel #2
0
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     Sqlite.DeleteValuesOR("OutTable", new string[] { "Email", "Name" }, new string[] { dgvw.Rows[rowIndex].Cells[columnIndex].Value.ToString(), dgvw.Rows[rowIndex].Cells[columnIndex].Value.ToString() });
     dgvw.Rows.RemoveAt(rowIndex);
 }