Advertisement
DSTRN

SignInPage

Jan 17th, 2022
618
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. import org.openqa.selenium.WebDriver;
  2. import org.openqa.selenium.WebElement;
  3. import org.openqa.selenium.support.FindBy;
  4.  
  5. public class SingInPage {
  6.  
  7.     private WebDriver driver;
  8.  
  9.     @FindBy(id = "email")
  10.     private WebElement emailInput;
  11.  
  12.     @FindBy(id = "passwd")
  13.     private WebElement passwordInput;
  14.  
  15.     @FindBy(id = "SubmitLogin")
  16.     private WebElement submitButton;
  17.  
  18.     @FindBy(xpath = "//*[@id='center_column']/div[1]/ol/li")
  19.     private WebElement alertDivText;
  20.  
  21.     public SingInPage(WebDriver driver) {
  22.         this.driver = driver;
  23.     }
  24.  
  25.     public WebElement getEmailInput() {
  26.         return Utilities.visibilityWait(driver, this.emailInput, 10);
  27.     }
  28.  
  29.     public void setEmailInput(String value) {
  30.         WebElement el = getEmailInput();
  31.         el.clear();
  32.         el.sendKeys(value);
  33.     }
  34.  
  35.     public WebElement getPasswordInput() {
  36.         return Utilities.visibilityWait(driver, this.passwordInput, 10);
  37.     }
  38.  
  39.     public void setPasswordInput(String value) {
  40.         WebElement el = getPasswordInput();
  41.         el.clear();
  42.         el.sendKeys(value);
  43.     }
  44.  
  45.     public void submitBtnClick() {
  46.         Utilities.clickableWait(driver, this.submitButton, 10).click();
  47.     }
  48.  
  49.     // Wait for text
  50.  
  51.     public boolean errorMessagePresent(String text) {
  52.         return Utilities.textWait(driver, this.alertDivText, text, 10);
  53.     }
  54.  
  55. }
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement