Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Last active July 18, 2024 10:50
Show Gist options
  • Save SarahElson/e1b6f8b2a708225ea929e7e4281eb2f9 to your computer and use it in GitHub Desktop.
Save SarahElson/e1b6f8b2a708225ea929e7e4281eb2f9 to your computer and use it in GitHub Desktop.
What Is the Single Responsibility Principle (SRP)?
package com.lambdatest.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.By;
public class LoginPage{
WebDriver driver;
public LoginPage(WebDriver driver) {
this.driver = driver;
}
By enterEmailId = By.xpath("//input[@id='input-email']");
By enterPassword = By.xpath("//input[@id='input-password']");
By clickOnLogin = By.xpath("//input[@value='Login']");
public void enterEmailId(String email) {
driver.findElement(enterEmailId).sendKeys(email);
}
public void enterPassword(String password) {
driver.findElement(enterPassword).sendKeys(password);
}
public void clickOnLogin() {
driver.findElement(clickOnLogin).click();
}
public void goToURL(){
driver.get("https://ecommerce-playground.lambdatest.io/");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment