This project is a Web Page Performance Tester that measures key performance metrics of a web page, including page load time, resource counts (images, scripts, stylesheets), and the total number of HTTP requests. Additionally, it captures a screenshot of the page and exports the results in multiple formats (TXT, CSV, JSON).
- Measures page load time.
- Counts the number of images, scripts, and stylesheets loaded by the page.
- Tracks the total number of HTTP requests made during the page load.
- Captures a screenshot of the fully loaded page.
- Exports performance reports in:
- Plain-text (TXT).
- Comma-Separated Values (CSV).
- JavaScript Object Notation (JSON).
- Handles common errors such as timeout issues and invalid URLs.
- Python 3.8+ must be installed.
- Google Chrome must be installed.
- ChromeDriver must be downloaded (compatible with your Chrome version).
- You can download ChromeDriver from here.
- Ensure ChromeDriver.exe is placed in a folder named
webdriver/
inside the project directory.
Before running the script, ensure you have:
- Cloned the repository.
- Created and activated a virtual environment.
- Installed the required dependencies using
requirements.txt
.
To run the performance tester for a specific URL, use the following command:
python main.py --url <URL> --export <FORMAT>
- Replace
<URL>
with the web page URL you want to test. - Replace
<FORMAT>
with one of the following export formats:txt
(default): Exports a plain-text report.csv
: Exports a CSV report.json
: Exports a JSON report.all
: Exports all three formats (TXT, CSV, and JSON).
- Export a plain-text report for
https://example.com
:
python main.py --url https://example.com --export txt
- Export a CSV report for
https://example.com
:
python main.py --url https://example.com --export csv
- Export all report formats for
https://example.com
python main.py --url https://example.com --export all
The performance tester creates an output/
folder in the project directory. Inside this folder, the following subfolders and files are generated:
- Reports (
output/reports/
):
- Contains the performance reports in TXT, CSV, and JSON formats.
- Screenshots (
output/screenshots/
):
- Contains screenshots of the tested web pages in PNG format.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to copy, modify, and share this project. Contributions are welcome!