public string LoginUsingEmail(emailListModel model) { driver.Navigate().GoToUrl("https://www.usangels.com/account/login"); IWebElement EmailAddress = driver.FindElement(By.Name("EmailAddress")); EmailAddress.SendKeys(model.Email + "@gmail.com"); IWebElement Password = driver.FindElement(By.Name("Password")); Password.SendKeys(model.Password); string css = ".first p:nth-child(4) button"; // IWebElement Login = driver.FindElement(By.CssSelector(css)); IWebElement Login = driver.FindElement(By.ClassName("checkout")); Login.Click(); return(model.Email + "@gmail.com"); }
public string generateRandomEmail() { using (var context = new dbContext()) { string randomEmailString = ""; int count = 0; while (count == 0) { randomEmailString = generateRandomString(5); count++; emailListModel emailList = new emailListModel { Email = randomEmailString, Password = randomEmailString + "007" }; bool get = context.EmailLists.Any(r => r.Email == emailList.Email); if (get) { count = 0; } } emailListModel emailListToAdd = new emailListModel { Email = randomEmailString, Password = randomEmailString + "007" }; context.EmailLists.Add(emailListToAdd); context.SaveChanges(); context.Dispose(); return(randomEmailString); } }