A modular, enterprise-grade test automation framework built with Python, Pytest, and Selenium designed to demonstrate advanced Page Object Model (POM) architecture, CI/CD integration, and Automated Quality Reporting.
- Scalable Architecture: Implemented a clean Page Object Model (POM) to decouple test logic from UI selectors, ensuring high maintainability and code reusability.
- CI/CD Pipeline Orchestration: Architected a GitHub Actions workflow that automatically triggers browser-based testing on every code push, ensuring continuous quality assurance.
- Automated Reporting Dashboard: Integrated Allure Reports to transform raw terminal output into a stakeholder-ready dashboard, featuring historical trend graphs and failure analytics.
- Data-Driven Testing: Integrated with Pandas and Openpyxl to execute scenarios based on external data sources (e.g.,
data/data.xlsx). - Dynamic Bot Bypass & Failure Capture: Utilized Explicit Waits and XPath strategies to ensure test continuity and developed a custom Pytest hook in conftest.py that automatically captures and embeds browser screenshots directly into the Allure report upon test failure for rapid debugging.
- Automated WebDriver Management: Utilizes Selenium Manager to automatically handle browser driver compatibility (Chrome v147+).
- Advanced UI Interaction: Employs JavaScript execution strategies and WebDriverWait to handle dynamic elements and prevent
ElementClickInterceptedException.
- Core: Python 3.11
- Test Runner: Pytest
- Automation: Selenium WebDriver
- Reporting: Allure Framework
- Infrastructure: GitHub Actions
- Data Management: Pandas, Openpyxl
- Environment Setup: Runner initializes a headless Ubuntu environment and installs dependencies from
requirements.txt. - Execution: Pytest executes the Selenium suite in Headless Chrome mode to optimize performance in the cloud.
- Reporting: Raw results are processed by the Allure CLI to generate a static HTML site.
- Deployment The framework automatically pushes the fresh report to the
gh-pagesbranch, updating the live URL instantly.
- Bot Detection & Stealth: Faced and bypassed complex anti-bot measures (CAPTCHAs) by implementing Chrome Stealth arguments and User-Agent rotation, simulating authentic user behavior in a data-center environment.
- Automated Deployment Permissions: Resolved GitHub Actions "404" and deployment errors by fine-tuning repository write-permissions and architecting a clean-branch deployment strategy for GitHub Pages.
.
├── allure-results/ # Raw JSON/XML report data (generated at runtime)
├── data/ # External test data (Excel files)
├── pages/ # Page Object classes (SearchPage, ResultsPage, ProductPage)
├── screenshots/ # Auto-generated failure and progress snapshots
├── tests/ # Test suite (test_amazon.py)
├── utils.py # Reusable utilities for data reading and screenshots
├── conftest.py # Global fixtures and driver configuration
├── pytest.ini # Test runner configuration and discovery rules
├── .gitignore # Prevents pushing node_modules, .env, and local caches
└── requirements.txt # Project dependencies
- Clone the repository:
git clone https://github.com/natnaelhhaile/python-pytest-selenium-automation.git- Install dependencies:
pip install -r requirements.txt- Execute tests:
pytest --alluredir=allure-results- View reports:
allure serve allure-results