Automating web interactions using Python and Selenium
The purpose of this project is to automate web interactions using Python and Selenium. By utilizing the Selenium WebDriver, we can simulate user actions such as clicking buttons, filling forms, and scraping data from web pages. This automation can save time and effort in repetitive tasks, improve efficiency, and enable testing of web applications.
The project utilizes the Selenium WebDriver in Python to automate web interactions. It includes a custom WebDriver class that manages the WebDriver instance, provides setup and teardown methods, and offers utility functions such as waiting for elements to appear and taking screenshots.
The test_landing_page.py file contains test cases for the landing page of a website. The test cases demonstrate the usage of the WebDriver class and validate the functionality of the landing page. They include checks for page loading, element presence, and capturing screenshots on successful load or failure.
The project has been successfully tested, and all test cases pass, ensuring that the WebDriver and landing page functionality work as intended.
The repository has the following directory structure:
├── drivers
│ └── chromedriver
│ └── LICENSE.chromedriver
├── logs
│ └── test.log
├── screenshots
│ └── successful_load.png
├── src
│ ├── webdriver.py
│ ├── landing_page.py
├── tests
│ └── test_landing_page.py
├── utils
│ └── logger.py
└── README.md
- The
driversdirectory contains the ChromeDriver executable file (chromedriver) and its license file (LICENSE.chromedriver). - The
logsdirectory contains the log file (test.log). - The
screenshotsdirectory contains the screenshot file (successful_load.png). - The
srcdirectory contains the main source code files of the project, includingwebdriver.pyfor managing the Selenium WebDriver,landing_page.pyfor interacting with the landing page, and theutilsdirectory with thelogger.pyutility module. - The
testsdirectory contains the test file (test_landing_page.py) for testing the landing page functionality. - The
utilsdirectory contains the README file (README.md) specific to theutilsdirectory. - The root directory also contains the main README file (
README.md) for the entire project.
Please update this code box with your actual file structure as needed.
To run the project and replicate the workflow, follow these steps:
- Clone the repository:
git clone https://github.com/your-username/WebAutomatorPy.git - Install the necessary dependencies:
pip install -r requirements.txt - Download the appropriate ChromeDriver executable and update the
CHROMEDRIVER_PATHvariable intest_landing_page.pyandwebdriver.pywith the correct path. - Execute the test cases:
pytest
Make sure you have Python and Chrome installed on your system before running the project.
For more information and documentation on Selenium WebDriver and Python, refer to the following resources:
This project is a personal undertaking by Nathan T. Gundy. It aims to showcase web automation and testing skills using Python and Selenium.