This application enables you to capture screenshots of web performance test results for given URLs, supporting multiple platforms including Windows, macOS, and Linux.
- Google Chrome: Install Google Chrome on your machine. (The app will attempt to locate Chrome at default paths, but you can set the
GOOGLE_CHROME_BIN
environment variable if it’s installed elsewhere)- Windows: Default path is
C:\Program Files\Google\Chrome\Application\chrome.exe
(64-bit) orC:\Program Files (x86)\Google\Chrome\Application\chrome.exe
(32-bit). - macOS: Default path is
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
. - Linux: Install via your package manager (e.g.,
apt-get install google-chrome-stable
on Debian-based systems).
- Windows: Default path is
- Python 3.9+: Install Python from https://www.python.org/downloads/.
Follow these steps to set up and run the application on your machine:
-
Clone the Repository:
git clone https://github.com/yourusername/easy-page-speed-screenshots.git cd easy-page-speed-screenshots
-
Install Python Dependencies: Ensure you have
pip
installed, then installing all necessary Python packages by running:pip install -r requirements.txt
-
Run the Application:
- Start the app by running:
python app.py
- The app will be available at
http://127.0.0.1:5001
.
- Start the app by running:
-
Access the Web Interface:
- Open your web browser and go to
http://127.0.0.1:5001
.
- Open your web browser and go to
-
Enter URLs and Options:
- Enter one or more URLs (one per line) in the provided text area.
- Optionally, enable GTMetrix testing and provide a GTMetrix API key and location if desired.
- Click 'Submit' to start the screenshot process.
-
View Results:
- Once processing is complete, the app will display a list of generated screenshots (PSI Desktop, PSI Mobile, and optionally GTMetrix) or indicate failures.
- Screenshots are saved temporarily and can be viewed or downloaded from the results page.
- The app includes embedded ChromeDriver binaries in the
drivers
directory for Windows (chromedriver-win.exe
), macOS (chromedriver-mac
), and Linux (chromedriver-linux
), so no manual ChromeDriver installation is required. - On macOS or Linux, the app automatically sets execute permissions for the ChromeDriver binary. If permission issues occur, run
chmod +x drivers/chromedriver-mac
orchmod +x drivers/chromedriver-linux
manually. - Logs are written to
app.log
in the project directory for troubleshooting.
What should I do if Chrome is not found?
Ensure Google Chrome is installed in the default location for your operating system:- Windows:
C:\Program Files\Google\Chrome\Application\chrome.exe
(64-bit) orC:\Program Files (x86)\Google\Chrome\Application\chrome.exe
(32-bit). - macOS:
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
. - Linux: Install via your package manager (e.g.,
apt-get install google-chrome-stable
).
If Chrome is installed elsewhere, set the GOOGLE_CHROME_BIN
environment variable to the correct path (see Installation and Setup step 3). Check app.log
for messages like “Chrome binary not found” to confirm the issue.
Why am I seeing a permission issue on macOS or Linux?
The app automatically sets execute permissions for the ChromeDriver binary, but this might fail depending on your system. To fix this manually:- Run
chmod +x drivers/chromedriver-mac
(macOS) orchmod +x drivers/chromedriver-linux
(Linux) in the project directory. - Retry running the app.
What should I do if pages fail to load (network errors)?
Network errors might occur if you’re behind a proxy:- Test with a direct internet connection if possible.
- Ensure the
GOOGLE_CHROME_BIN
environment variable is set correctly (see Installation and Setup step 3). - If using a proxy, you may need to configure proxy settings in the app (contact the app maintainer for assistance).
Why am I seeing a "[WinError 193]" error on Windows?
The `[WinError 193] %1 is not a valid Win32 application` error typically occurs due to an architecture mismatch:- Ensure both your Chrome and Python installations are 64-bit. Check Python’s architecture with:
It should return
python -c "import platform; print(platform.architecture())"
('64bit', 'WindowsPE')
. - If Python or Chrome is 32-bit, reinstall the 64-bit version:
- Python: Download from https://www.python.org/downloads/.
- Chrome: Download from https://www.google.com/chrome/.
- Reinstall dependencies after upgrading Python:
pip install -r requirements.txt
.
What if I encounter memory issues when deploying to Render?
If deploying to Render and seeing `SIGKILL` errors (e.g., “Worker was sent SIGKILL! Perhaps out of memory?”):- Consider upgrading to a higher memory plan on Render (e.g., the Standard tier with 2 GB RAM).
- Test with simpler URLs to confirm if the issue is related to page complexity.
- Check
app.log
for memory usage details (logged viapsutil
) to identify peak usage.
- Report issues or suggest improvements by creating a pull request or opening an issue in the repository.
- Ensure Chrome and ChromeDriver versions match when updating dependencies.