Framework -
Now its time to create helper method for each page/tab in application. Starting from
Login Page -> Home Page -> so on
Will write code to verify few stuff in login page and Home page , same is applied to other pages too.
Note : All these class inherits WebCommon base class.
LoginPage.java
package com.qt.web.automation.helpers;
import com.qt.automation.helpers.WebCommon;
public class LoginPage extends WebCommon
{
public boolean loginWithValidCredentials()
{
webDriverManagerObj.find("name", "username").sendKeys("admin");
webDriverManagerObj.find("name", "pwd").sendKeys("manager");
webDriverManagerObj.find("id", "loginButton").click();
return webDriverManagerObj.find("xpath", ".//*[@id='topnav']/tbody/tr[1]/td[1]/div/div[3]/img").isDisplayed();
}
}
{
public boolean loginWithValidCredentials()
{
webDriverManagerObj.find("name", "username").sendKeys("admin");
webDriverManagerObj.find("name", "pwd").sendKeys("manager");
webDriverManagerObj.find("id", "loginButton").click();
return webDriverManagerObj.find("xpath", ".//*[@id='topnav']/tbody/tr[1]/td[1]/div/div[3]/img").isDisplayed();
}
}
HomePage.java
package com.qt.web.automation.helpers;
import com.qt.automation.helpers.WebCommon;
public class HomePage extends WebCommon
{
public boolean verifyActitimeLogo()
{
return webDriverManagerObj.find("xpath", ".//*[@id='topnav']/tbody/tr[1]/td[1]/div/div[3]/img").isDisplayed();
}
}
{
public boolean verifyActitimeLogo()
{
return webDriverManagerObj.find("xpath", ".//*[@id='topnav']/tbody/tr[1]/td[1]/div/div[3]/img").isDisplayed();
}
}

No comments:
Post a Comment