Selenium Java POM Framework from Scratch π
Learn to build a complete Selenium Java POM framework with Maven, TestNG, and ExtentReports step by step.

Automation Step by Step
33.6K views β’ Feb 18, 2025

About this video
Selenium Java - Complete Framework
Maven, TestNG, ExtentReports, POM
We will learn:
Environment Setup: Installing necessary tools
Project Setup: Creating a Maven project
Adding Dependencies: Selenium, TestNG, Selenium Manager, Logging, Reporting β¦
Page Object Model (POM) Implementation
Execution with TestNG
Reporting
My project: https://github.com/Raghav-Pal/SeleniumAutomationFramework2025
Full Playlist - https://www.youtube.com/playlist?list=PLhW3qG5bs-L_zQUmcXPs0F_e159DZ8OrP
00:00 *TOPICS*
01:31 Project Setup: Installing necessary tools
Step 1 - Install Java JDK java -version
Step 2 - Install Maven mvn -version
Step 3 - Install Eclipse IDE (Releases - https://archive.eclipse.org/eclipse/downloads/)
08:58 Create a Maven Project in Eclipse
Step 4 - Open Eclipse - File οΌ New οΌ Maven Project
Step 5 - Add Dependencies in pom.xml
selenium-java
selenium-manager
testng
log4j
extent-reports
Step 6 - Run mvn -U clean install Eclipse - Rt click on project οΌ Maven οΌ Update
23:00 Setup Project Structure (POM)
Step 1 - Create the following framework structure in your project
selenium-framework
βββ src/main/java
β βββ base
β β βββ BaseTest.java
β βββ pages
β β βββ LoginPage.java
β βββ utils
β β βββ ConfigReader.java
β β βββ Log.java
βββ src/test/java
β βββ tests
β β βββ LoginTest.java
βββ testng.xml
βββ log4j2.xml
βββ extent-config.xml
βββ pom.xml
πΉ Benefits of This Structure
β Modular β Easy to update individual components
β Reusable β Page Object Model (POM) reduces duplication
β Maintainable β Logs, reports, and configurations are separate
β Scalable β Supports adding more pages and tests seamlessly
26:39 What is Page Object Model
31:45 Create Base Test Class
Step 1 - Under package base create a java class BaseTest.java
Step 2 - Add code to initialize the browser and handle test setup
package base;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
public class BaseTest {
protected WebDriver driver;
@BeforeMethod
public void setUp() {
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://example.com");
}
@AfterMethod
public void tearDown() {
if (driver != null) {
driver.quit();
}
}
}
42:26 Implement Page Object Model (POM)
42:38 Step 1 - Under package pages create a java class LoginPage.java
package pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class LoginPage {
private WebDriver driver;
private By usernameField = By.id("Email");
private By passwordField = By.id("Password");
private By loginButton = By.xpath("//*[@id=\"main\"]/div[3]/button");
public LoginPage(WebDriver driver) {
this.driver = driver;
}
public void enterUsername(String username) {
driver.findElement(usernameField).sendKeys(username);
}
public void enterPassword(String password) {
driver.findElement(passwordField).sendKeys(password);
}
public void clickLogin() {
driver.findElement(loginButton).click();
}
}
58:21 Step 2 - Under package tests create a java class LoginTest.java
package tests;
import base.BaseTest;
import org.testng.Assert;
import org.testng.annotations.Test;
import pages.LoginPage;
public class LoginTest extends BaseTest {
@Test
public void testValidLogin() {
LoginPage loginPage = new LoginPage(driver);
loginPage.enterUsername("admin@yourstore.com");
loginPage.enterPassword("admin");
loginPage.clickLogin();
Assert.assertEquals(driver.getTitle(), "Dashboard");
}
}
01:05:36 Step 3 - Add testng plugin to Eclipse
01:10:41 Step 4 - Run the test as testng test can also run using mvn test
01:13:37 Step 5 - Check TestNG Reports
01:16:20 Create testng.xml file
Step 1 - Create a file under project and name it testng.xml
Your testng.xml file is a TestNG configuration file that defines how your test suite should be executed
Step 2 - Run the file or run with command mvn test
Step 3 - Check TestNG Reports
1:22:28 Element Locators & Browser Interactions Reference
β¬β¬β¬β¬β¬β¬β¬
Share with all who may need this
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
β¬β¬β¬β¬ USEFUL LINKS β¬β¬β¬β¬
β ALL TUTORIALS - https://AutomationStepByStep.com/
π Connect with Raghav:
* Ask Raghav: https://bit.ly/2CoJGWf
* GitHub: https://github.com/Raghav-Pal
* Udemy: https://www.udemy.com/user/raghav-pal-3/
Shorts Eng - https://bit.ly/3H9bifV
Shorts Hindi - https://bit.ly/3XY7XqN
β‘οΈ Subscribe for more videos: https://www.youtube.com/@RaghavPal
β
Maven, TestNG, ExtentReports, POM
We will learn:
Environment Setup: Installing necessary tools
Project Setup: Creating a Maven project
Adding Dependencies: Selenium, TestNG, Selenium Manager, Logging, Reporting β¦
Page Object Model (POM) Implementation
Execution with TestNG
Reporting
My project: https://github.com/Raghav-Pal/SeleniumAutomationFramework2025
Full Playlist - https://www.youtube.com/playlist?list=PLhW3qG5bs-L_zQUmcXPs0F_e159DZ8OrP
00:00 *TOPICS*
01:31 Project Setup: Installing necessary tools
Step 1 - Install Java JDK java -version
Step 2 - Install Maven mvn -version
Step 3 - Install Eclipse IDE (Releases - https://archive.eclipse.org/eclipse/downloads/)
08:58 Create a Maven Project in Eclipse
Step 4 - Open Eclipse - File οΌ New οΌ Maven Project
Step 5 - Add Dependencies in pom.xml
selenium-java
selenium-manager
testng
log4j
extent-reports
Step 6 - Run mvn -U clean install Eclipse - Rt click on project οΌ Maven οΌ Update
23:00 Setup Project Structure (POM)
Step 1 - Create the following framework structure in your project
selenium-framework
βββ src/main/java
β βββ base
β β βββ BaseTest.java
β βββ pages
β β βββ LoginPage.java
β βββ utils
β β βββ ConfigReader.java
β β βββ Log.java
βββ src/test/java
β βββ tests
β β βββ LoginTest.java
βββ testng.xml
βββ log4j2.xml
βββ extent-config.xml
βββ pom.xml
πΉ Benefits of This Structure
β Modular β Easy to update individual components
β Reusable β Page Object Model (POM) reduces duplication
β Maintainable β Logs, reports, and configurations are separate
β Scalable β Supports adding more pages and tests seamlessly
26:39 What is Page Object Model
31:45 Create Base Test Class
Step 1 - Under package base create a java class BaseTest.java
Step 2 - Add code to initialize the browser and handle test setup
package base;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
public class BaseTest {
protected WebDriver driver;
@BeforeMethod
public void setUp() {
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://example.com");
}
@AfterMethod
public void tearDown() {
if (driver != null) {
driver.quit();
}
}
}
42:26 Implement Page Object Model (POM)
42:38 Step 1 - Under package pages create a java class LoginPage.java
package pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class LoginPage {
private WebDriver driver;
private By usernameField = By.id("Email");
private By passwordField = By.id("Password");
private By loginButton = By.xpath("//*[@id=\"main\"]/div[3]/button");
public LoginPage(WebDriver driver) {
this.driver = driver;
}
public void enterUsername(String username) {
driver.findElement(usernameField).sendKeys(username);
}
public void enterPassword(String password) {
driver.findElement(passwordField).sendKeys(password);
}
public void clickLogin() {
driver.findElement(loginButton).click();
}
}
58:21 Step 2 - Under package tests create a java class LoginTest.java
package tests;
import base.BaseTest;
import org.testng.Assert;
import org.testng.annotations.Test;
import pages.LoginPage;
public class LoginTest extends BaseTest {
@Test
public void testValidLogin() {
LoginPage loginPage = new LoginPage(driver);
loginPage.enterUsername("admin@yourstore.com");
loginPage.enterPassword("admin");
loginPage.clickLogin();
Assert.assertEquals(driver.getTitle(), "Dashboard");
}
}
01:05:36 Step 3 - Add testng plugin to Eclipse
01:10:41 Step 4 - Run the test as testng test can also run using mvn test
01:13:37 Step 5 - Check TestNG Reports
01:16:20 Create testng.xml file
Step 1 - Create a file under project and name it testng.xml
Your testng.xml file is a TestNG configuration file that defines how your test suite should be executed
Step 2 - Run the file or run with command mvn test
Step 3 - Check TestNG Reports
1:22:28 Element Locators & Browser Interactions Reference
β¬β¬β¬β¬β¬β¬β¬
Share with all who may need this
If my work has helped you, consider helping any animal near you, in any way you can
Never Stop Learning
Raghav Pal
β¬β¬β¬β¬ USEFUL LINKS β¬β¬β¬β¬
β ALL TUTORIALS - https://AutomationStepByStep.com/
π Connect with Raghav:
* Ask Raghav: https://bit.ly/2CoJGWf
* GitHub: https://github.com/Raghav-Pal
* Udemy: https://www.udemy.com/user/raghav-pal-3/
Shorts Eng - https://bit.ly/3H9bifV
Shorts Hindi - https://bit.ly/3XY7XqN
β‘οΈ Subscribe for more videos: https://www.youtube.com/@RaghavPal
β
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
33.6K
Likes
585
Duration
01:23:46
Published
Feb 18, 2025
User Reviews
4.7
(6) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
No specific trending topics match this video yet.
Explore All Trends