Skip to content

devendraDPI/selenium-automation-framework-for-ecommerce-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selenium Automation Framework for E-commerce Website

Project Overview

This project is a robust, modular Selenium Automation Framework designed to automate key user workflows of a demo E-commerce website using Java, Selenium WebDriver, TestNG, and Maven.

The framework follows industry best practices such as the Page Object Model (POM) with page factory, data-driven testing, reusable utilities, structured reporting, and cross-browser execution.

Features Overview

  • End-to-end automation of E-commerce workflows
  • Page Object Model (POM) architecture
  • Cross-browser execution (Chrome, Firefox, Edge)
  • Data-driven testing using Excel
  • Selenium 4 advanced features (Relative Locators, CDP)
  • Parallel execution using TestNG
  • Retry mechanism for flaky tests
  • Explicit, Implicit, and Fluent waits
  • Advanced user interactions (Actions class)
  • Screenshot capture for failures
  • Extent HTML Reports & TestNG reports
  • Centralized logging using Log4j2

Concepts Applied

This project demonstrates the following automation and testing concepts:

  • Page Object Model (POM) with page factory implementation
  • TestNG Annotations, Groups, Priorities & Dependencies
  • Data-Driven Testing (Apache POI – Excel)
  • Selenium WebDriver API
  • Selenium 4 Features:
    • Relative Locators
    • Chrome DevTools Protocol (CDP)
    • Multi-tab & window handling
  • Synchronization:
    • Implicit Wait
    • Explicit Wait
    • Fluent Wait
  • Retry Logic using IRetryAnalyzer
  • Maven lifecycle & Surefire plugin
  • Logging & Reporting
  • Modular and reusable framework design

Technology Stack

Technology Purpose
Java Programming language
Selenium WebDriver 4 Browser automation
TestNG Test framework
Maven Build & dependency management
Apache POI Excel data handling
Extent Reports HTML test reporting
Log4j2 Logging

Project structure

.
|-- pom.xml
`-- src
    |-- main
    |   |-- java
    |   |   `-- com
    |   |       `-- selenium
    |   |           `-- automation
    |   |               `-- framework
    |   |                   |-- base
    |   |                   |   `-- BasePage.java
    |   |                   |-- pages
    |   |                   |   |-- CheckoutPage.java
    |   |                   |   |-- HomePage.java
    |   |                   |   |-- LoginPage.java
    |   |                   |   |-- ProductDetailsPage.java
    |   |                   |   |-- RegisterPage.java
    |   |                   |   `-- ShoppingCartPage.java
    |   |                   `-- utils
    |   |                       |-- ActionsUtil.java
    |   |                       |-- ConfigUtil.java
    |   |                       |-- DropdownUtil.java
    |   |                       |-- ExcelUtil.java
    |   |                       |-- ExtentManager.java
    |   |                       |-- LogUtil.java
    |   |                       |-- RetryAnalyzerUtil.java
    |   |                       |-- ScreenShotUtil.java
    |   |                       |-- TestListener.java
    |   |                       `-- WaitUtil.java
    |   `-- resources
    |       |-- config.json
    |       |-- extentConfig.xml
    |       `-- log4j2.xml
    `-- test
        |-- java
        |   `-- com
        |       `-- selenium
        |           `-- automation
        |               `-- framework
        |                   |-- base
        |                   |   |-- BaseTest.java
        |                   |   `-- BaseTestTNG.java
        |                   |-- dataProvider
        |                   |   |-- ExcelDataProvider.java
        |                   |   `-- TestDataProvider.java
        |                   `-- tests
        |                       |-- CompleteUserWorkFlow.java
        |                       |-- LoginFlowTest.java
        |                       |-- LogoutFlowTest.java
        |                       |-- ProductCheckoutFlowTest.java
        |                       |-- RegisterFlowTest.java
        |                       |-- SetUpTest.java
        |                       `-- demo
        |                           |-- ActionsClassAdvancedInteractionsTest.java
        |                           |-- AlertIFrameWindowsTest.java
        |                           |-- DataProviderTest.java
        |                           |-- ElementHandlingTest.java
        |                           |-- ExcelDataProviderTest.java
        |                           |-- PriorityGroupsDependsOnTest.java
        |                           |-- RetryTest.java
        |                           |-- SeleniumFeatureTest.java
        |                           `-- WaitTest.java
        `-- resources
            |-- LoginData.xlsx
            |-- testng.xml
            `-- testngTNG.xml

22 directories, 43 files

Installation & Setup

  1. Ensure the following are installed

    1. Java 25
    2. Maven 3.9.11
    3. Browsers
      1. Google Chrome 143
      2. Edge 143
      3. Firefox 146
    4. Any IDE or terminal
  2. Clone the repository

git clone https://github.com/devendraDPI/selenium-automation-framework-for-ecommerce-website.git
  1. Navigate to the project folder
   cd selenium-automation-framework-for-ecommerce-website
  1. Run the test (using any one command)
    mvn clean test                      # Runs on by default chrome browser
    mvn clean test -Dbrowser=edge       # Runs on edge browser
    mvn clean test -Dbrowser=firefox    # Runs on firefox browser
    mvn clean test -Dbrowser=chrome     # Runs on chrome browser

Video

  • See how the Selenium Automation Framework for E-commerce Website works in this video walkthrough.

YouTube

License

  • MIT License: See License file for details.

About

Selenium Automation Framework for E-commerce workflows built using Java, Selenium 4, TestNG, and Maven. Implements Page Object Model, data-driven testing with Excel, cross-browser execution, Selenium 4 features (CDP, relative locators), retries, waits, logging, and Extent reporting.

Topics

Resources

License

Stars

Watchers

Forks

Contributors