Skip to content

viivue/easy-page-speed-screenshots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easy Page Speed Screenshots

This application enables you to capture screenshots of web performance test results for given URLs, supporting multiple platforms including Windows, macOS, and Linux.

Prerequisites

  • 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) or C:\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).
  • Python 3.9+: Install Python from https://www.python.org/downloads/.

Installation and Setup

Follow these steps to set up and run the application on your machine:

  1. Clone the Repository:

    git clone https://github.com/yourusername/easy-page-speed-screenshots.git
    cd easy-page-speed-screenshots
  2. Install Python Dependencies: Ensure you have pip installed, then installing all necessary Python packages by running:

    pip install -r requirements.txt
  3. Run the Application:

    • Start the app by running:
      python app.py
    • The app will be available at http://127.0.0.1:5001.

Usage

  1. Access the Web Interface:

    • Open your web browser and go to http://127.0.0.1:5001.
  2. 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.
  3. 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.

Notes

  • 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 or chmod +x drivers/chromedriver-linux manually.
  • Logs are written to app.log in the project directory for troubleshooting.

FAQs & 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) or C:\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) or chmod +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:
    python -c "import platform; print(platform.architecture())"
    It should return ('64bit', 'WindowsPE').
  • If Python or Chrome is 32-bit, reinstall the 64-bit version:
  • 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 via psutil) to identify peak usage.

Contributing

  • 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.

License

MIT License