Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Test]
- public void RegistrationTest()
- {
- var guid = Guid.NewGuid();
- var username = $"{guid.ToString()}@email.com";
- var password = "password";
- _driver.Navigate().GoToUrl("http://automationpractice.com/index.php");
- _driver.FindElement(By.ClassName("login")).Click();
- _driver.FindElement(By.Id("email_create")).SendKeys(username);
- _driver.FindElement(By.Id("SubmitCreate")).Click();
- var waitForSubmitCreate = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));
- waitForSubmitCreate.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.UrlContains("my-account#account-creation"));
- _driver.FindElement(By.Id("id_gender2")).Click();
- _driver.FindElement(By.Id("customer_firstname")).SendKeys("FirstName");
- _driver.FindElement(By.Id("customer_lastname")).SendKeys("Lastname");
- _driver.FindElement(By.Id("passwd")).SendKeys(password);
- _driver.FindElement(By.Id("address1")).SendKeys("TotallyAddress");
- _driver.FindElement(By.Id("city")).SendKeys("MyCity");
- IWebElement dropList = _driver.FindElement(By.Id("id_state"));
- SelectElement clickThis = new SelectElement(dropList);
- clickThis.SelectByIndex(1);
- _driver.FindElement(By.Id("postcode")).SendKeys("00000");
- _driver.FindElement(By.Id("phone_mobile")).SendKeys("123123123");
- _driver.FindElement(By.Id("submitAccount")).Click();
- var waitForSubmit = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));
- waitForSubmit.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementExists(By.ClassName("navigation_page")));
- StringAssert.Contains(_driver.Url, "controller=my-account");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement