Skip to content

literallydotdev/selenium-best-practices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced Selenium Demo

This repository contains the code for a demo application and its corresponding Selenium test automation framework. It's designed to showcase advanced techniques and best practices.

The project demonstrates:

  • A component-based Page Object Model (POM)
  • Robust waiting strategies (Explicit and Fluent Waits)
  • Best practices for locators

Getting Started

Prerequisites

You need to have Python and pip installed on your machine. We recommend using a virtual environment to manage dependencies.

# Clone the repository
git clone https://github.com/tarunsinghofficial/selenium-test-bp.git
cd selenium-test-bp

Installation

  1. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows, use .\venv\Scripts\activate
  2. Install the required dependencies:

    pip install -r requirements.txt

Running the Demo App

To run the web application for testing:

python serve_app.py

The app will be accessible at http://localhost:8000. Make sure you keep running the application.


Running the Tests

Make sure the demo app is running in a separate terminal.

# Run all tests
pytest tests/

Run tests in parallel with Grid:

  1. Start Selenium Grid (standalone)
java -jar selenium-server-4.35.0.jar standalone
  1. Run tests
.\cross_browser_test.bat test-local

Run tests with cross-browser implementation:

.\cross_browser_test.bat test-local

Reference

For more details on the code and the advanced concepts, please refer to the accompanying blog post.

About

Accompanying code for the article: Selenium Best Practices: Advanced Techniques for Stable Tests

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors