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/Seleniu...
Full Playlist - • Selenium Java 2025
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/d...)
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: / @raghavpal
—
On this page of the site you can watch the video online Selenium Java Complete POM Framework | Step by Step from Scratch with a duration of hours minute second in good quality, which was uploaded by the user Automation Step by Step 18 February 2025, share the link with friends and acquaintances, this video has already been watched 54,032 times on youtube and it was liked by 861 viewers. Enjoy your viewing!