-
-
Save testautomationtribe/ead18386bb520dbb4e1bdf0d225b4625 to your computer and use it in GitHub Desktop.
unsucessful implementation
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
using OpenQA.Selenium; | |
using OpenQA.Selenium.Support.PageObjects; | |
namespace TatAuto.Pages | |
{ | |
public class LoginPObject | |
{ | |
[FindsBy(How = How.Id, Using = "user_login")] | |
protected IWebElement UsernameTxtBox { get; set; } | |
[FindsBy(How = How.Id, Using = "user_pass")] | |
protected IWebElement PasswordTxtBox { get; set; } | |
[FindsBy(How = How.Id, Using = "wp-submit")] | |
protected IWebElement LoginBtn { get; set; } | |
[FindsBy(How = How.Id, Using = "login_error")] | |
protected IWebElement ErrorText { get; set; } | |
private readonly IWebDriver _driver; | |
public LoginPObject(IWebDriver driver) | |
{ | |
_driver = driver; | |
PageFactory.InitElements(_driver, this); | |
} | |
public DashboardPObject LoginAs(string username, string password) | |
{ | |
Login(username, password); | |
return new DashboardPObject(_driver); | |
} | |
public LoginPObject LoginUnsuccessfullyAs(string username, string password) | |
{ | |
Login(username, password); | |
return this; | |
} | |
public string GetErrorMessage() | |
{ | |
return ErrorText.Text; | |
} | |
private void Login(string username, string password) | |
{ | |
UsernameTxtBox.SendKeys(username); | |
PasswordTxtBox.SendKeys(password); | |
LoginBtn.Click(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment