public void NotDisplayCookies() { using (IWebDriver driver = new ChromeDriver()) { driver.Navigate().GoToUrl(homePageUrl); driver.Manage().Window.Maximize(); DemoHelper.Pause(); driver.Manage().Cookies.AddCookie(new Cookie("AcceptedCookies", "true")); driver.Navigate().Refresh(); ReadOnlyCollection <IWebElement> messege = driver.FindElements(By.Id("CookiesBeingUsed")); Assert.Empty(messege); Cookie cookieValue = driver.Manage().Cookies.GetCookieNamed("acceptedCookies"); Assert.Equal("true", cookieValue.Value); driver.Manage().Cookies.DeleteCookieNamed("acceptedCookies"); } }
public void RegisterUser() { using (IWebDriver driver = new ChromeDriver()) { driver.Navigate().GoToUrl(homePageUrl); driver.Manage().Window.Maximize(); DemoHelper.Pause(); //var sportsLink = driver.FindElement(By.LinkText("sports")); driver.FindElement(By.CssSelector("[aria-label='Sign up']")).Click(); DemoHelper.Pause(); driver.FindElement(By.Id("Comp1_Title")).Click(); driver.FindElement(By.CssSelector("[value='Mrs']")).Click(); driver.FindElement(By.Id("Comp2_FirstName")).SendKeys("Jane"); DemoHelper.Pause(); driver.FindElement(By.Id("Comp3_Surname")).SendKeys("Brown"); DemoHelper.Pause(); driver.FindElement(By.CssSelector("[value = '1992']")).Click(); driver.FindElement(By.Id("Comp4_DateDropdownMonth")).Click(); DemoHelper.Pause(); driver.FindElement(By.CssSelector("[value = '3']")).Click(); // var dateMonth = driver.FindElement(By.Id("Comp4_DateDropdownMonth")); // var month = new SelectElement(dateMonth); // Assert.Equal("03", dateMonth); //foreach(IWebDriver Option in dateMonth.Options) //driver.FindElement(By.Id("Comp4_DateDropdownValue")).Click(); //driver.FindElement(By.CssSelector("[value = '28']")).Click(); driver.FindElement(By.Id("Comp15_OptInBonus")).Click(); driver.FindElement(By.Id("Comp16_TermsAndConditions")).Click(); } }