0% found this document useful (0 votes)
38 views

Page Object Model Format

The document outlines a Java project structure for a Selenium-based automation framework, detailing various packages and their classes. Key components include driver management, common utility methods, locators for web elements, and page functions for executing actions. It provides a basic implementation of a login functionality using these components.

Uploaded by

RAVI Ranjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Page Object Model Format

The document outlines a Java project structure for a Selenium-based automation framework, detailing various packages and their classes. Key components include driver management, common utility methods, locators for web elements, and page functions for executing actions. It provides a basic implementation of a login functionality using these components.

Uploaded by

RAVI Ranjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Driver Package:

Driver Class: For Storing Driver

Common Package:

CommonUtilsMethod Class: For Storing Methods

LocatorPackage:

HomeLocator Class: For Storing Locators

LoginLocator Class:

PayemntLocator Class:

PageFunction Package:

HomePageMethod Class: For storing Methods

LoginLocatorMethod Class:

PayemntLocator Class:

TestData Pckage

Json Class: For storing vales

=====================================================================================

package Driver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class DriverClass {
public WebDriver getDriver()
{
WebDriver driver =new ChromeDriver();
driver.get("https://rahulshettyacademy.com/locatorspractice");
return driver;

}
}

=====================================================================================
package CommonFunction;
import org.openqa.selenium.By;
import Driver.DriverClass;
public class CommonUtilsMethod {
DriverClass d=new DriverClass();
public void clickOn(String s)
{
d.getDriver().findElement(By.xpath(s)).click();
}
public void sendKey(String abc)
{
d.getDriver().findElement(By.xpath(abc)).sendKeys("Ravi Ranjan");
}
}
=====================================================================================
package Locator;

public class LoginLocator {

String Username="//input[@id='inputUsername']";
String Pass="//input[@name='inputPassword']";
String LoginBtn="button[type='submit']";

public String getusrName() {


// TODO Auto-generated method stub
return Username;
}

======================================================================
package PageFunctions;
import CommonFunction.CommonUtilsMethod;
import Locator.LoginLocator;
public class Login {
static Login ln=new Login();
CommonUtilsMethod c=new CommonUtilsMethod();
LoginLocator l=new LoginLocator();
public static void main(String []args)
{
ln.verfyLogin();
}
public void verfyLogin()
{
String abc=l.getusrName();
c.sendKey(abc);
}
}

You might also like