A Selenium WebDriver automation framework using Java, TestNG, and Page Object Model (POM) design pattern for testing web applications.
Selenium_Project/
│
├── .github/
│ └── workflows/
│ └── maven-tests.yml # GitHub Actions CI/CD workflow
│
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ ├── pages/ # Page Object Model classes
│ │ │ │ ├── BasePage.java
│ │ │ │ └── Elements.java
│ │ │ └── utils/ # Utility classes
│ │ │ ├── ConfigReader.java
│ │ │ ├── DriverManager.java
│ │ │ └── TestUrls.java
│ │ └── resources/
│ │ └── config.properties # Configuration file
│ │
│ └── test/
│ └── java/
│ └── tests/ # Test classes
│ ├── BaseTest.java
│ └── ElementsTest.java
│
├── target/
│ └── surefire-reports/ # Test execution reports
│
├── testng.xml # TestNG suite configuration
├── pom.xml # Maven dependencies
├── mvnw & mvnw.cmd # Maven wrapper scripts
└── README.md
- Java 21
- Selenium WebDriver 4.16.1
- TestNG 7.8.0
- WebDriverManager 5.6.3 - Automatic browser driver management
- Maven - Build and dependency management
- Java JDK 21 or higher
- Chrome, Firefox, or Edge browser installed
- IDE (IntelliJ IDEA, Eclipse, or VS Code) - optional
Note: Maven installation is NOT required - this project includes Maven wrapper.
-
Clone the repository
git clone <repository-url> cd Selenium_Project
-
Verify Java installation
java -version
-
Build the project
Windows:
.\mvnw.cmd clean installMac/Linux:
./mvnw clean install
Windows:
.\mvnw.cmd testMac/Linux:
./mvnw test.\mvnw.cmd test -DsuiteXmlFile=testng.xml.\mvnw.cmd test -Dbrowser=chrome # default
.\mvnw.cmd test -Dbrowser=firefox
.\mvnw.cmd test -Dbrowser=edgeEdit src/main/resources/config.properties:
# Browser Configuration
browser=chrome # Options: chrome, firefox, edge
# Application URL
baseUrl=https://demoqa.com
# Timeout Configuration (in seconds)
implicitWait=10
explicitWait=15
pageLoadTimeout=30This project includes a GitHub Actions workflow (.github/workflows/maven-tests.yml) that:
- Runs tests automatically on push/pull requests to main, master, and develop branches
- Supports manual workflow dispatch
- Uses Ubuntu latest with Chrome
- Uploads test reports as artifacts (30-day retention)
After test execution, view reports at:
target/surefire-reports/index.html
Windows:
start target/surefire-reports/index.htmlMac:
open target/surefire-reports/index.htmlLinux:
xdg-open target/surefire-reports/index.html- ✅ Page Object Model (POM) - Clean separation of test logic and page elements
- ✅ WebDriverManager - No manual driver downloads required
- ✅ ThreadLocal WebDriver - Thread-safe for parallel execution
- ✅ Externalized Configuration - Easy environment management
- ✅ Explicit Waits - Stable and reliable test execution
- ✅ TestNG Integration - Powerful test orchestration and reporting
- ✅ CI/CD Ready - GitHub Actions workflow included
- ✅ Cross-Browser Support - Chrome, Firefox, and Edge
-
Create Page Object:
- Add new class in
src/main/java/pages/ - Extend
BasePagefor reusable methods - Define web elements using
@FindByannotations
- Add new class in
-
Create Test Class:
- Add new class in
src/test/java/tests/ - Extend
BaseTestfor automatic setup/teardown - Write test methods with
@Testannotation
- Add new class in
-
Update TestNG Suite:
- Add test class to
testng.xmlif needed
- Add test class to
- Modern Page Object Model implementation
- Clean, maintainable code structure
- Industry-standard design patterns
- Automated CI/CD pipeline
- Comprehensive test reporting