Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Selenium E2E Automation Tests

Overview

This project contains End-to-End (E2E) automated tests developed using Python and Selenium WebDriver.

The tests simulate key user journeys of a web application, including: • User Registration (Sign Up) • User Login • Payment / Checkout

The project follows the Page Object Model (POM) design pattern to improve code readability, maintainability, and reusability.

Project Structure


├── tests/
│   ├── test_login.py
│   ├── test_signup.py
│   └── test_payment.py
│
├── pages/
│   ├── login_page.py
│   ├── signup_page.py
│   └── payment_page.py
│
├── utils/
│   └── driver_setup.py
│
└── README.md

Folder Description

tests/

This folder contains the test scripts responsible for automating user actions and verifying expected outcomes. • test_login.py • Opens the login page • Enters username and password • Clicks the login button • Verifies successful login • test_signup.py • Opens the registration page • Fills out the registration form • Selects gender • Enters date of birth • Submits the form • test_payment.py • Simulates the checkout process • Completes payment • Verifies successful transaction

pages/

This folder contains page locators.

Each page class stores the locations of: • Input fields • Buttons • Dropdown menus • Radio buttons • Other page elements

Example:

from selenium.webdriver.common.by import By

class LoginPage:

USERNAME = (
    By.NAME,
    "username"
)

PASSWORD = (
    By.NAME,
    "password"
)

LOGIN_BUTTON = (
    By.XPATH,
    "//button[text()='Login']"
)

Separating locators from tests makes the project easier to maintain when the UI changes.

utils/

This folder contains reusable utility functions.

driver_setup.py is responsible for: • Creating the browser instance • Installing ChromeDriver automatically • Maximizing the browser window • Returning the WebDriver object

Example:

from selenium import webdriver

def get_driver():

driver = webdriver.Chrome()

driver.maximize_window()

return driver

Technologies Used • Python 3.x • Selenium WebDriver • Chrome Browser • WebDriver Manager

Installation

Clone the repository

git clone

Move into the project directory

cd project

Install dependencies

pip install selenium

pip install webdriver-manager

Running Tests

Run the login test:

python tests/test_login.py

Run the signup test:

python tests/test_signup.py

Run the payment test:

python tests/test_payment.py

Locator Strategy

Stable locators are preferred in the following order:

  1. By.ID
  2. By.NAME
  3. By.CSS_SELECTOR
  4. By.XPATH using visible text

Preferred

(By.NAME, "firstName")

(By.CSS_SELECTOR, "input[placeholder='DD/MM/YYYY']")

(By.XPATH, "//button[text()='Login']")

Avoid

(By.ID, "radix-:R12lqb6:")

Dynamic IDs generated by UI frameworks may change between sessions and can make tests unstable.

Waiting Strategy

Explicit waits are used to ensure that elements are available before interaction.

Example:

from selenium.webdriver.support.ui import WebDriverWait

from selenium.webdriver.support import expected_conditions as EC

wait = WebDriverWait(driver, 10)

username = wait.until(

EC.presence_of_element_located(

    LoginPage.USERNAME

)

)

This reduces test failures caused by slow page loading.

Future Improvements

Possible improvements include: • Using Pytest for test execution • Generating HTML reports • Running tests in headless mode • Capturing screenshots on failure • Supporting multiple browsers • Integrating with CI/CD pipelines

Author : Fehintolu Samuel, Abdulraheem

Created as a learning project for practicing End-to-End (E2E) web automation using Python, Selenium WebDriver, and the Page Object Model (POM).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages