Advertisement
Guest User

Untitled

a guest
May 7th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public HompePage(WebDriver driver)
  2. {
  3. this.driver = driver;
  4. PageFactory.initElements(driver, this);
  5. }
  6.  
  7. public class BasePage
  8. {
  9. private By username = By.id("username");
  10. private By password = By.id("password");
  11. private By loginBtn = By.name("loginbtn");
  12.  
  13. public void userLogin(String userName, String password)
  14. {
  15. driver.findElement(username).sendKeys("testuser");
  16. driver.findElement(password).sendKeys("testpassword");
  17. driver.findElement(loginBtn).click();
  18. }
  19. }
  20.  
  21. public class BasePage {
  22. @FindBy(id= "username") private WebElement userName;
  23. @FindBy(id= "password") private WebElement password;
  24. @FindBy(id= "login") private WebElement loginBtn;
  25.  
  26. public void userLogin(String userName, String password) {
  27. userName.sendKeys(userName);
  28. password.sendKeys(password);
  29. loginBtn.click();
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement