public void sendQuestion() { HomePage home = new HomePage(driver); home.Navigate(); NewsPage news = home.NewsClick(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20); //Thread.Sleep(2000); Test test = news.MoreClick(); //news.goToHaveYourSayClick(); HaveYourSayPage say = test.HaveYourSayClick(); AskYouQuestion share = say.HowToAskClick(); var text = "a"; var name = "Maxym Hevko"; var email = "*****@*****.**"; var age = "20"; var postcode = "text "; var phone = "12345678"; share.PushComments(text); share.PushName(name); share.PushEmail(email); share.PushAge(age); share.PushPostCode(postcode); share.PushPhone(phone); string currentUrl = share.GetUrl(); string actualUrl = "https://www.bbc.com/news/uk-politics-49577632"; Assert.AreEqual(actualUrl, currentUrl); }
public BBCSiteFacade() { webDriver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); webDriver.Manage().Timeouts().ImplicitWait = new TimeSpan(0, 0, 7); webDriver.Manage().Window.Maximize(); questionToBBCPage = new DoYouHaveAQuestionToBBCPage(webDriver); bBCNewsPage = new BBCNewsPage(webDriver); bBCMainPage = new BBCMainPage(webDriver); haveYourSayPage = new HaveYourSayPage(webDriver); searchPage = new SearchPage(webDriver); }
public void TestIsItHaveYourSayPage() { //Arrange _driver.Navigate().GoToUrl("https://www.bbc.com/"); _driver.Manage().Window.Maximize(); var searchText = "Have Your Say"; //Act var haveyoursay = new HaveYourSayPage(_driver); haveyoursay.News_StoryPage(); //Assert var resultText = new HaveYourSayPage(_driver); Assert.AreEqual(searchText, resultText.SearchText.Text); }
public void FillTheForm(Dictionary<string, string> values, bool screenShot) { HaveYourSayPage haveyoursay = new HaveYourSayPage(driver); driver.Navigate().GoToUrl("https://www.bbc.com/"); driver.FindElement(By.XPath(GetTextXPath("News", 2))).Click(); driver.FindElement(By.XPath("//nav[@role='navigation']/ul/li[last()]")).Click(); driver.FindElement(By.XPath("//a[@class='nw-o-link']/span[contains(text(),'Have Your Say')]")).Click(); haveyoursay.questionToBBC.Click(); haveyoursay.userName.SendKeys(values["Name"]); haveyoursay.userEmail.SendKeys(values["Email address"]); haveyoursay.age.SendKeys(values["Age"]); haveyoursay.postcode.SendKeys(values["Postcode"]); haveyoursay.daily.Click(); haveyoursay.textarea.SendKeys(values["What"]); if (screenShot == true) ((ITakesScreenshot)driver).GetScreenshot().SaveAsFile("D:/QA-C#/Automation/hello.png"); else { haveyoursay.submit.Click(); foreach (KeyValuePair<string, string> value in values) { if (value.Value == "" && value.Key == "Name") { if (!haveyoursay.inputENT.Displayed) throw new Exception(); } if (value.Value == "" && value.Key == "Email address") { if (!haveyoursay.inputEET.Displayed) throw new Exception(); } } } }
public void SubmitQuestion(Dictionary <string, string> fields) { HomePage home = new HomePage(_driver); HaveYourSayPage haveYourSay = new HaveYourSayPage(_driver); home.GoToBBCPage(); NewsPage news = home.goToNewsPage(); news.ClickMore(); news.goToHaveYourSayPage(); haveYourSay.ClickQuestionLink(); haveYourSay._fieldForQuestion = _driver.FindElement(By.XPath(haveYourSay.GetFormXpath("What questions would you like us to investigate?"))); haveYourSay._nameField = _driver.FindElement(By.XPath(haveYourSay.GetFormXpath("Name"))); haveYourSay._emailField = _driver.FindElement(By.XPath(haveYourSay.GetFormXpath("Email address"))); haveYourSay._ageField = _driver.FindElement(By.XPath(haveYourSay.GetFormXpath("Age"))); haveYourSay._postCodeField = _driver.FindElement(By.XPath(haveYourSay.GetFormXpath("Postcode"))); haveYourSay._fieldForQuestion.SendKeys(fields["What questions would you like us to investigate?"]); haveYourSay._nameField.SendKeys(fields["Name"]); haveYourSay._emailField.SendKeys(fields["Email address"]); haveYourSay._ageField.SendKeys(fields["Age"]); haveYourSay._postCodeField.SendKeys(fields["Postcode"]); haveYourSay.ClickDailyNewsSubscribe(); }