public void ShouldCreateDoodlePageObjectWithAttributes() { _driver.Navigate().GoToUrl("http://doodle.com/en_GB/"); _driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(10)); var scheduleEventButton = _driver.FindElement( By.CssSelector("#doodleExample > div.wizardOrExample.spaceBBefore > a")); scheduleEventButton.Click(); Assert.AreEqual(_driver.Url, "http://doodle.com/create"); var nameScreenPageObject = new NameScreenAttrPageObject(_driver); nameScreenPageObject .FillData("Diwebsity test doodle", "Diwebsity tester", "*****@*****.**") .NextButton.Navigate(); var dateId = "#cell" + DateTime.Now.ToString("yyyyMMdd"); var waitDriver = new WebDriverWait(_driver, TimeSpan.FromSeconds(10)); waitDriver.Until( ExpectedConditions.ElementToBeClickable(By.CssSelector(dateId))); _driver.FindElement(By.CssSelector(dateId)) .Click(); _driver.FindElement(By.Id("next2a")) .Click(); _driver.FindElement(By.Id("do0_0")) .SendKeys("12:00"); _driver.FindElement(By.Id("do0_1")) .SendKeys("13:00"); _driver.FindElement(By.Id("do0_2")) .SendKeys("14:00"); _driver.FindElement(By.Id("next2b")) .Click(); waitDriver.Until( ExpectedConditions.ElementToBeClickable(By.Id("next3s"))); _driver.FindElement(By.Id("next3s")) .Click(); waitDriver.Until( ExpectedConditions.ElementToBeClickable(By.Id("finish4a"))); Thread.Sleep(1000); _driver.FindElement(By.Id("finish4a")) .Click(); waitDriver.Until( ExpectedConditions.ElementToBeClickable(By.Id("participationLink"))); var surveyUrl = _driver.FindElement(By.Id("participationLink")).Text; _driver.Navigate().GoToUrl(surveyUrl); Assert.AreEqual(_driver.FindElement(By.Id("pollTitle")).Text, "Diwebsity test doodle"); }
public void ShouldCreateDoodlePageObjectFluent() { _driver.Navigate().GoToUrl("http://doodle.com/en_GB/"); var scheduleEventButton = _driver.FindElement( By.CssSelector("#doodleExample > div.wizardOrExample.spaceBBefore > a")); scheduleEventButton.Click(); Assert.AreEqual(_driver.Url, "http://doodle.com/create"); var nameScreenPageObject = new NameScreenAttrPageObject(_driver); nameScreenPageObject .Then(x => x.TitleInput.SendKeys("Diwebsity test doodle")) .Then(x => x.YourNameInput.SendKeys("Diwebsity tester")) .Then(x => x.EmailInput.SendKeys("*****@*****.**")) .ClickButton(x => x.BackButton); }