This project demonstrates how to automate navigation menu tests for QA Testing Hub using Selenium WebDriver and pure Python (no frameworks required).
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
- 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.
Make sure you have Python 3.8+ installed.
Install Selenium:
pip install seleniumDownload the ChromeDriver that matches your Chrome version and add it to your system PATH.
- Place your files in the structure shown above.
- Make sure your folder names are all lowercase (pages,resources,tests).
Open a terminal in the project root and run:
python -m tests.test_navigation_menuor, if you are inside the tests folder:
python test_navigation_menu.py- [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.
- 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.
- 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.pymatch exactly what appears on the website.
MIT License