A professional, beginner-friendly Selenium automation testing framework built with Python, PyTest and the Page Object Model (POM) design pattern. Designed to be portfolio-ready and suitable for internship interviews.
| Module | Target Site | Tests |
|---|---|---|
| Login | the-internet.herokuapp.com | Valid/invalid login, logout, empty fields |
| Signup | demoqa.com | Form submission, required fields, dynamic data |
| Search | automationexercise.com | Search query, results count, Enter key |
| Navigation | the-internet.herokuapp.com | Link routing, back button, page titles |
| Form Validation | demoqa.com | Empty submit, invalid email, digits-only phone |
firefox_ui_automation/
โ
โโโ ๐ .github/
โ โโโ ๐ workflows/
โ โโโ ci.yml # GitHub Actions CI/CD pipeline
โ
โโโ ๐ config/
โ โโโ __init__.py
โ โโโ config.py # Centralized config (URLs, timeouts, credentials)
โ
โโโ ๐ pages/ # Page Object Model classes
โ โโโ __init__.py
โ โโโ base_page.py # Base class - common Selenium methods
โ โโโ login_page.py # Login page elements + actions
โ โโโ signup_page.py # Signup/registration form
โ โโโ search_page.py # Search functionality
โ โโโ navigation_page.py # Site navigation + links
โ โโโ form_validation_page.py # Form validation behavior
โ
โโโ ๐ tests/ # PyTest test files
โ โโโ __init__.py
โ โโโ test_login.py # 8 login test cases
โ โโโ test_signup.py # 6 signup test cases
โ โโโ test_search.py # 7 search test cases
โ โโโ test_navigation.py # 8 navigation test cases
โ โโโ test_form_validation.py # 7 form validation test cases
โ
โโโ ๐ utils/ # Reusable helper utilities
โ โโโ __init__.py
โ โโโ logger.py # Colored console + file logging
โ โโโ screenshot.py # Screenshot capture utility
โ โโโ wait_helper.py # Explicit wait wrappers
โ โโโ test_data_generator.py # Faker-based dynamic test data
โ
โโโ ๐ test_data/
โ โโโ __init__.py
โ โโโ test_data.json # Static test data (credentials, expected values)
โ
โโโ ๐ reports/ # HTML test reports (auto-generated, git-ignored)
โโโ ๐ screenshots/ # Test screenshots (auto-generated, git-ignored)
โโโ ๐ logs/ # Log files (auto-generated, git-ignored)
โ
โโโ conftest.py # PyTest fixtures (driver setup/teardown)
โโโ pytest.ini # PyTest configuration
โโโ requirements.txt # Python dependencies
โโโ .env.example # Environment variable template
โโโ .gitignore # Git exclusions
โโโ README.md # This file
Before you begin, make sure you have installed:
- Python 3.8+
- Firefox browser
- Git (for cloning the repo)
Note: You do NOT need to manually download GeckoDriver! The
webdriver-managerlibrary handles this automatically.
Step 1 - Clone the repository
git clone https://github.com/YOUR_USERNAME/firefox-ui-automation.git
cd firefox-ui-automationStep 2 - Create a virtual environment
A virtual environment keeps this project's dependencies isolated from other Python projects.
# Create virtual environment
python -m venv venv
# Activate it:
# On macOS/Linux:
source venv/bin/activate
# On Windows (Command Prompt):
venv\Scripts\activate.bat
# On Windows (PowerShell):
venv\Scripts\Activate.ps1You should see (venv) at the start of your terminal prompt.
Step 3 - Install dependencies
pip install -r requirements.txtStep 4 - Configure environment
cp .env.example .env
# The default settings work out of the box!
# Edit .env if you want to change the BASE_URL or credentials.Step 5 - Run the tests!
# Run all tests
pytest
# Run with visible browser (watch it work!)
pytest --headless=false
# Run only smoke tests (quick check)
pytest -m smoke
# Run only login tests
pytest -m login
# Run a specific test file
pytest tests/test_login.py
# Run a specific test function
pytest tests/test_login.py::TestLogin::test_valid_loginStep 6 - View the HTML report
After the run, open the generated report in your browser:
# macOS
open reports/test_report.html
# Linux
xdg-open reports/test_report.html
# Windows
start reports/test_report.html# Run all tests (verbose output)
pytest -v
# Run in headless mode (no browser window)
pytest --headless=true
# Run specific marker groups
pytest -m smoke # Quick sanity checks
pytest -m login # Login tests only
pytest -m signup # Signup tests only
pytest -m search # Search tests only
pytest -m navigation # Navigation tests only
pytest -m validation # Form validation tests only
# Combine markers
pytest -m "smoke and login" # Smoke + login
pytest -m "not signup" # Everything except signup
# Run against a different site
pytest --base-url=https://demoqa.com
# Stop after first failure
pytest -x
# Stop after N failures
pytest --maxfail=3
# Run with full tracebacks on failure
pytest --tb=long
# Show test durations (slowest tests first)
pytest --durations=10| Site | URL | Best For |
|---|---|---|
| The Internet | the-internet.herokuapp.com | Login, navigation, alerts, dropdowns |
| DemoQA | demoqa.com | Rich forms, date pickers, modals |
| Automation Exercise | automationexercise.com | E-commerce, search, cart |
| OrangeHRM | opensource-demo.orangehrmlive.com | HR system, login, dashboards |
| ParaBank | parabank.parasoft.com | Banking app, transfers |
This project uses the Page Object Model design pattern. Here's why:
โ Without POM (bad): โ
With POM (good):
โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ
test_login.py test_login.py
driver.find_element( login_page.login(
By.ID, "username" โ "tomsmith",
).send_keys("user") "password"
driver.find_element( )
By.ID, "password"
).send_keys("pass")
driver.find_element(
By.CSS_SELECTOR, "button"
).click()
If the button's CSS changes: If the button's CSS changes:
โ Update in EVERY test file โ Update ONCE in login_page.py
Key concepts:
- Each webpage โ one Page class (e.g.,
LoginPage,SearchPage) - Locators (CSS/ID selectors) live inside the Page class
- Tests call readable methods:
login_page.login(user, password) BasePageprovides shared browser interaction methods
After each run, an HTML report is generated at reports/test_report.html:
- โ Green = Passed
- โ Red = Failed
โ ๏ธ Yellow = Skipped/Xfail- Screenshot thumbnails for failed tests
- Test duration for each case
- Environment metadata (Python version, browser, timestamp)
The .github/workflows/ci.yml pipeline automatically:
- Installs Firefox on Ubuntu
- Sets up Python 3.11
- Installs all dependencies
- Runs the full test suite in headless mode
- Uploads the HTML report as a downloadable artifact
- Posts a summary to the GitHub Actions dashboard
Triggers:
- Every push to
mainordevelop - Every Pull Request to
main - Daily at 6:00 AM UTC (scheduled regression)
- Manual trigger from the Actions tab
Here are 8-10 meaningful commits for a professional GitHub history:
1. feat: initialize project with POM folder structure and requirements.txt
2. feat: add conftest.py with Firefox WebDriver fixture and pytest configuration
3. feat: implement BasePage class with reusable Selenium interaction methods
4. feat: add LoginPage POM and test_login.py with 8 test cases
5. feat: add SignupPage POM and test_signup.py with Faker data generator
6. feat: add SearchPage POM and test_search.py with parametrized queries
7. feat: add NavigationPage POM and test_navigation.py with link validation
8. feat: add FormValidationPage and test_form_validation.py with edge cases
9. feat: add GitHub Actions CI/CD workflow for automated test execution
10. docs: add comprehensive README with setup guide and architecture docs
Once you're comfortable with the basics, here are ways to scale this framework:
- Allure Reports - richer test reports with graphs and trends
- pytest-xdist - run tests in parallel (faster execution:
pytest -n 4) - Cross-browser - add Chrome support alongside Firefox
- Data-driven tests - load test cases from CSV/Excel files
- API testing layer - add
requestslibrary to test REST APIs - Database verification - connect to test DB to verify data persistence
- Visual regression - screenshot diffing with
pytest-image-snapshot - Docker - containerize the test environment for portability
- Selenium Grid - distribute tests across multiple machines
- BrowserStack/Sauce Labs - run on real devices in the cloud
- Page Factory - lazy element initialization for performance
- Custom pytest plugins - reusable test infrastructure across projects
- Reporting dashboard - Grafana + InfluxDB for long-term test trends
- Fork the repository
- Create a feature branch:
git checkout -b feat/add-cart-tests - Commit your changes:
git commit -m 'feat: add shopping cart test cases' - Push to your branch:
git push origin feat/add-cart-tests - Open a Pull Request
MIT License - free to use for personal and commercial projects.
Built as a learning project for internship preparation.
"The best way to learn test automation is to automate something real."