Created
January 19, 2017 19:17
-
-
Save angelovstanton/47588b6ebd26cb64c95aff0561da991c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BingMainPage | |
{ | |
private readonly IWebDriver driver; | |
private readonly string url = @"http://www.bing.com/"; | |
public BingMainPage(IWebDriver browser) | |
{ | |
this.driver = browser; | |
PageFactory.InitElements(browser, this); | |
} | |
[FindsBy(How = How.Id, Using = "sb_form_q")] | |
public IWebElement SearchBox { get; set; } | |
[FindsBy(How = How.Id, Using = "sb_form_go")] | |
public IWebElement GoButton { get; set; } | |
[FindsBy(How = How.Id, Using = "b_tween")] | |
public IWebElement ResultsCountDiv { get; set; } | |
public void Navigate() | |
{ | |
this.driver.Navigate().GoToUrl(this.url); | |
} | |
public void Search(string textToType) | |
{ | |
this.SearchBox.Clear(); | |
this.SearchBox.SendKeys(textToType); | |
this.GoButton.Click(); | |
} | |
public void ValidateResultsCount(string expectedCount) | |
{ | |
Assert.IsTrue(this.ResultsCountDiv.Text.Contains(expectedCount), "The results DIV doesn't contains the specified text."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment