Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Last active July 18, 2024 10:51
Show Gist options
  • Save SarahElson/3c12d6eed4f836cb8434cea18c812dc5 to your computer and use it in GitHub Desktop.
Save SarahElson/3c12d6eed4f836cb8434cea18c812dc5 to your computer and use it in GitHub Desktop.
What Is the Single Responsibility Principle (SRP)?
package com.lambdatest.mainpagecomponents;
import com.lambdatest.pagecomponents.MyAccountPage;
import com.lambdatest.pagecomponents.NavigationBar;
import com.lambdatest.pagecomponents.SearchProduct;
import com.lambdatest.pagecomponents.SpecialLinkBar;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
public class LambdaTestHomePage {
private WebDriver driver;
private SearchProduct searchProduct;
private SpecialLinkBar specialLinkBar;
private NavigationBar navigationBar;
private MyAccountPage myAccountPage;
public LambdaTestHomePage(final WebDriver driver){
this.driver=driver;
this.searchProduct= PageFactory.initElements(driver,SearchProduct.class);
this.specialLinkBar= PageFactory.initElements(driver,SpecialLinkBar.class);
this.navigationBar= PageFactory.initElements(driver,NavigationBar.class);
this.myAccountPage=PageFactory.initElements(driver,MyAccountPage.class);
}
public void goTo() {
this.driver.get("https://ecommerce-playground.lambdatest.io/");
}
public SearchProduct getSearchProduct() {
return searchProduct;
}
public NavigationBar getNavigationBar() {
return navigationBar;
}
public SpecialLinkBar getSpecialLinkBar() {
return specialLinkBar;
}
public MyAccountPage myAccountPage(){
return myAccountPage;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment