Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌐 Selenium Automation Framework

End-to-end UI test automation framework built with Python, Selenium WebDriver, and PyTest — following the Page Object Model (POM) design pattern.

Python Selenium PyTest Status


📌 What This Framework Tests

Automates a complete E-Commerce user journey on a practice application:

Login → Browse Shop → Add Product to Cart → Checkout → Enter Delivery Address → Validate Order Success

Tests are data-driven — the same flow runs with multiple products/users from a JSON file automatically.


🛠️ Tech Stack

Tool Purpose
Python 3.11 Primary language
Selenium WebDriver 4.x Browser automation
PyTest Test runner & framework
Page Object Model Framework design pattern
JSON Test data management
pytest-html HTML test reporting

📁 Project Structure

SeleniumFramework/
│
├── pageObjects/               # Page Object Model classes
│   ├── login_page.py          # Login page actions & locators
│   ├── shop_page.py           # Shop / product listing page
│   └── checkout_page.py       # Checkout & order confirmation page
│
├── tests/                     # Test files
│   └── test_e2e.py            # End-to-end parametrized test
│
├── utils/                     # Reusable utilities
│   └── browserutils.py        # Base class with common browser methods
│
├── data/                      # Test data
│   └── test_data.json         # User credentials + product names
│
├── reports/                   # Auto-generated (gitignored)
│   └── report.html            # HTML test report
│
├── conftest.py                # Shared fixtures, browser setup, screenshot hook
├── pytest.ini                 # PyTest configuration
├── requirements.txt           # Project dependencies
└── .gitignore

✨ Key Features

  • Page Object Model — locators and actions separated from test logic
  • Data-Driven Testing — JSON-based parametrize, easy to add new test cases
  • Cross-Browser Support — Chrome, Firefox, Edge via CLI flag
  • Auto Screenshot on Failure — captured and embedded in HTML report
  • HTML Reports — self-contained pytest-html report after every run
  • Clean Separation — pages / tests / utils / data in separate folders
  • Base Page ClassBrowserUtils inherited by all page objects

🚀 How to Run

1. Clone the repo

git clone https://github.com/Dipakthoughts/SeleniumFramework.git
cd SeleniumFramework

2. Create virtual environment

python -m venv venv
source venv/bin/activate      # Mac/Linux
venv\Scripts\activate         # Windows

3. Install dependencies

pip install -r requirements.txt

4. Run all tests (Chrome by default)

pytest

5. Run on a specific browser

pytest --browser_name firefox
pytest --browser_name edge

6. Run with verbose output

pytest -v -s

7. View the report

Open reports/report.html in your browser after the run.


🧪 Test Data

Tests are parametrized using data/test_data.json:

{
  "data": [
    {
      "userEmail": "rahulshettyacademy",
      "userPassword": "Learning@830$3mK2",
      "productName": "Blackberry"
    },
    {
      "userEmail": "rahulshettyacademy",
      "userPassword": "Learning@830$3mK2",
      "productName": "Samsung Note 8"
    }
  ]
}

Add more rows to test with more products — no code changes needed.


📊 Sample Report Output

========================= test session starts ==========================
collected 2 items

tests/test_e2e.py::test_e2e_order_flow[test_data0]  PASSED  [ 50%]
tests/test_e2e.py::test_e2e_order_flow[test_data1]  PASSED  [100%]

========================== 2 passed in 34.2s ===========================

👤 Author

Dipak Chavke — Junior QA Automation Engineer

About

E2E UI Automation Framework using Python, Selenium WebDriver & PyTest — Page Object Model, Data-Driven Testing, Cross-Browser, HTML Reports

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages