Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Last active October 20, 2018 21:05
Show Gist options
  • Save johnmmoss/3cc529c0530e6b82180f7f99fa654d82 to your computer and use it in GitHub Desktop.
Save johnmmoss/3cc529c0530e6b82180f7f99fa654d82 to your computer and use it in GitHub Desktop.
public class HomePage
{
private readonly IWebDriver webDriver;
public HomePage(IWebDriver webDriver)
{
this.webDriver = webDriver;
}
public LoginPage ClickLoginLink()
{
var loginLink = webDriver.FindElement(By.Id("LoginLink"));
loginLink.Click();
return new LoginPage(webDriver);
}
public bool IsLoggedIn()
{
return webDriver.FindElement(By.Id("LogoutLink")).Displayed;
}
}
public class LoginPage
{
private readonly IWebDriver webDriver;
public LoginPage(IWebDriver webDriver)
{
this.webDriver = webDriver;
}
public void EnterUsername(string username)
{
webDriver.FindElement(By.Id("Username")).SendKeys(username);
}
public void EnterPassword(string password)
{
webDriver.FindElement(By.Id("Password")).SendKeys(password);
}
public void ClickLogin()
{
webDriver.FindElement(By.Id("Login")).Click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment