What is the best way to handle navigation using page object model (java serenity)

I'm relatively new to page object pattern. What is the best approach for handling navigation? I don't want have multiple methods for each section or to use enum to store locators. Is this approach makes sense, or there are better options?

HeaderNavigationPage

public class HeaderNavigation extends PageObject{

@FindBy(xpath = "")

private WebElementFacade categoryMenu;

@FindBy(xpath = "(//button[contains(@title,'Sign In')])[1]")

private WebElementFacade signInButton;

@FindBy(xpath = "")

private WebElementFacade timeslotButton;

public WebElementFacade getCategoryMenu() {

return categoryMenu;

}

public WebElementFacade getSignInButton() {

return signInButton;

}

public WebElementFacade gettimeslotButton() {

return timeslotButton;

}

public void ClickOnHeaderNavItem(WebElementFacade element){

boolean elementVisible = element.isVisible();

if (!elementVisible) {

element.withTimeoutOf(30, SECONDS).waitUntilVisible();

}

element.click();

}

}

LoginSteps

public class LoginInSteps {

private HeaderNavigation headerNavigation;

private HomePage homePage;

private LoginPage loginPage;

@Step("The user is...

Read More »

By: StackOverFlow - Tuesday, 13 March

Related Posts