Skip to content

s2mcunha/selenium-python-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selenium Python Demo

This project demonstrates how to automate navigation menu tests for QA Testing Hub using Selenium WebDriver and pure Python (no frameworks required).

Project Structure

selenium-python-demo/
│
├── pages/
│   └── menu_page.py         # Page Object for menu interactions
│
├── resources/
│   └── test_data.py         # Test data: URL and expected menu texts
│
├── tests/
│   └── test_navigation_menu.py  # Main test script
│
├── requirements.txt         # Project dependencies
└── README.md                # Project documentation

How It Works

  • The test script opens the website in Chrome.
  • For each menu option, it clicks the menu and checks if the expected text appears on the page.
  • Results are printed in the terminal, showing which tests passed or failed.
  • The browser closes automatically at the end.

Getting Started

1. Install Dependencies

Make sure you have Python 3.8+ installed.

Install Selenium:

pip install selenium

Download the ChromeDriver that matches your Chrome version and add it to your system PATH.

2. Project Setup

  • Place your files in the structure shown above.
  • Make sure your folder names are all lowercase (pages, resources, tests).

3. Run the Test

Open a terminal in the project root and run:

python -m tests.test_navigation_menu

or, if you are inside the tests folder:

python test_navigation_menu.py

4. Interpreting Results

  • [PASS] means the menu navigation worked and the expected text was found.
  • [FAIL] means the expected text was not found after clicking a menu option.
  • At the end, you will see a summary message.

Customization

  • To test other menu options or texts, edit resources/test_data.py.
  • To change how the menu is interacted with, edit pages/menu_page.py.

Troubleshooting

  • If you see ModuleNotFoundError, check your folder names and imports (they must be lowercase).
  • If Selenium cannot find ChromeDriver, ensure it is installed and in your PATH.
  • If the browser opens but nothing happens, check if the menu texts in test_data.py match exactly what appears on the website.

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published