Created
February 19, 2017 12:01
-
-
Save angelovstanton/ee92aac75616a3294f2d13c851f05e0a 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); | |
} | |
public string Url => @"http://www.bing.com/"; | |
[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 AssertResultsCount(string expectedCount) => Assert.AreEqual(this.ResultsCountDiv.Text, expectedCount); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment