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
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-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows, use .\venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
To run the web application for testing:
python serve_app.pyThe app will be accessible at http://localhost:8000. Make sure you keep running the application.
Make sure the demo app is running in a separate terminal.
# Run all tests
pytest tests/Run tests in parallel with Grid:
- Start Selenium Grid (standalone)
java -jar selenium-server-4.35.0.jar standalone- Run tests
.\cross_browser_test.bat test-localRun tests with cross-browser implementation:
.\cross_browser_test.bat test-localFor more details on the code and the advanced concepts, please refer to the accompanying blog post.