Last active
October 20, 2018 21:05
-
-
Save johnmmoss/3cc529c0530e6b82180f7f99fa654d82 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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