A comprehensive Python automation tool that analyzes website performance using Google Lighthouse via PageSpeed Insights and generates detailed reports.
- β π Simple Performance Dashboard - Clean, focused performance overview
- β π§Ή Clean CSV Structure - CSV contains Core Web Vitals data
- β Mobile & Desktop Scores - Captures both device types
- β πΈ Full HD Screenshot Capture - Optional mobile and desktop screenshots
- β Automated PageSpeed Analysis - Tests multiple URLs automatically
- β π§Ή Streamlined architecture - Essential metrics without complexity
- β π¨ Professional UI/UX - Single-focus design with Core Web Vitals
- β Batch Processing - Analyze hundreds of URLs with configurable delays
- β Smart URL Validation - Validates URLs and handles malformed entries
- β Cross-Platform - Dynamic paths work on Windows, macOS, and Linux
- β π Core Web Vitals matrix - Detailed performance metrics with color coding
- β π Clean CSV output - Essential performance data only
- Performance - Loading speed and optimization
- Accessibility - Usability for users with disabilities
- Best Practices - Modern web development standards
- SEO - Search engine optimization factors
- First Contentful Paint (FCP) - Time to first content render
- Largest Contentful Paint (LCP) - Time to largest content render
- Total Blocking Time (TBT) - Main thread blocking time
- Cumulative Layout Shift (CLS) - Visual stability metric
- Speed Index - How quickly page contents are populated
The HTML dashboard uses Google's official Core Web Vitals thresholds for color coding:
- Performance Scores: β₯90
- First Contentful Paint: β€1.8s
- Largest Contentful Paint: β€2.5s
- Total Blocking Time: β€200ms
- Cumulative Layout Shift: β€0.1
- Speed Index: β€3.4s
- Performance Scores: 50-89
- Core Web Vitals: Between good and poor thresholds
- Performance Scores: <50
- First Contentful Paint: >3.0s
- Largest Contentful Paint: >4.0s
- Total Blocking Time: >600ms
- Cumulative Layout Shift: >0.25
- Speed Index: >5.8s
For experienced users who want to get started immediately:
# Clone the repository
git clone https://github.com/manishsongirkar/lighthouse-automation-suite.git
cd lighthouse-automation-suite
# Run enhanced automated setup (recommended)
chmod +x setup.sh
./setup.sh
# Validate setup (optional but recommended)
python validate_setup.py
# Add your URLs to analyze
echo "https://example.com" >> urls.txt
# Run the complete enhanced workflow (recommended)
python run_analysis.py
# View the results
# Dashboard opens automatically in browserYour comprehensive dashboard will be ready in minutes! For detailed setup and customization options, see the full setup instructions below.
- Python 3.7+
- Google Chrome browser
- Internet connection
# 1. Clone or download this project
git clone https://github.com/manishsongirkar/lighthouse-automation-suite.git
cd lighthouse-automation-suite
# 2. Run the enhanced automated setup script
chmod +x setup.sh
./setup.sh
# 3. Validate your setup (optional but recommended)
python validate_setup.pyThe enhanced setup script will automatically:
- β Detect your operating system (macOS, Linux, Windows)
- β Check Python 3.7+ installation with version validation
- β Create virtual environment (.venv/) with cross-platform support
- β Install all required dependencies from requirements.txt
- β
Create sample
urls.txtfile with examples and documentation - β Verify Google Chrome installation across all platforms
- β Test all modules and ChromeDriver download capability
- β Provide comprehensive setup validation and next steps
- β Give platform-specific activation instructions
- Clone or download this project
git clone https://github.com/manishsongirkar/lighthouse-automation-suite.git
cd lighthouse-automation-suite- Set up Python environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\\Scripts\\activate- Install dependencies
pip install -r requirements.txt- Configure URLs to test
Edit
urls.txtand add your URLs (one per line):
https://www.example.com
https://www.yoursite.com
https://www.competitor.com
python run_analysis.pyThis runs the full enhanced workflow:
- π§Ή Automatic cleanup of old report files
- π Lighthouse analysis with comprehensive metrics
- πΈ Optional Full HD screenshots of mobile and desktop views
- π¨ Enhanced tabbed dashboard generation
- π Auto-opens the dashboard in your browser
The tool now includes optional Full HD screenshot capture functionality:
Enable Screenshots:
When running python run_analysis.py, you'll be prompted:
πΈ Enable Full HD full-page screenshot capture? (Y/n): Y
Screenshot Features:
- β Full HD Quality: 1920px width with complete page height
- β Mobile & Desktop Views: Captures both device perspectives
- β
Automatic Organization: Timestamped directories (
screenshots-YYYYMMDD_HHMMSS/) - β Professional Quality: Ready for presentations and reports
Screenshot Files Generated:
screenshots-20251030_115303/
βββ fullhd_mobile_01_www.google.com.png # Mobile view
βββ fullhd_desktop_01_www.google.com.png # Desktop view
βββ fullhd_mobile_02_www.github.com.png # Mobile view
βββ fullhd_desktop_02_www.github.com.png # Desktop view
Use Cases:
- π Visual verification of performance scores
- π Client presentations with high-quality screenshots
- π Documentation for before/after comparisons
- π― Quality assurance for automated analysis
python generate_html_report.pyCreates the performance dashboard with optimization insights
Lighthouse analysis only:
python main.pyHTML dashboard only (after analysis):
python generate_html_report.py- Core performance metrics only - No cluttered internal fields
- Excel/Google Sheets ready - Direct import without cleanup
- Contains all scores and Core Web Vitals metrics
- Backward compatible - Same format as before for existing workflows
- π Clean performance overview with Core Web Vitals matrix
- Color-coded performance indicators with Google thresholds
- Responsive design - Works perfectly on all devices
- Professional styling focused on essential metrics
- π± Mobile Screenshots:
fullhd_mobile_XX_url.png- Full HD mobile view - π₯οΈ Desktop Screenshots:
fullhd_desktop_XX_url.png- Full HD desktop view - Professional Quality: 1920px width with complete page capture
- Organized Structure: Timestamped directories with safe filenames
- Summary statistics with Core Web Vitals
- Performance issue alerts with color indicators
- Average scores across all URLs
- Actionable recommendations
$ python3 run_analysis.py
π Lighthouse Automation Suite Workflow
==================================================
π§Ή Cleaning up existing result files...
βΉοΈ pagespeed_results.csv does not exist (skip)
βΉοΈ pagespeed_report.html does not exist (skip)
β
Cleanup completed - no files to remove
β
Using virtual environment: .venv/bin/python
π URL Analysis Results:
π Total lines in file: 2
β
Valid URLs found: 2
πΈ Enable Full HD full-page screenshot capture? (Y/n): Y
πΈ Using optimized script with Full HD screenshot capture
π Optimized Lighthouse Analysis with Full HD Screenshots...
β
Successfully loaded 2 valid URLs from urls.txt
πΈ Screenshots will be saved to a timestamped directory
π Starting Lighthouse analysis for 2 URLs...
============================================================
π Processing URL 1/2 (50.0%)
π Current URL: https://www.google.com
============================================================
π§ Chrome optimized: Headless mode, performance-focused settings
Navigating to: https://pagespeed.web.dev/analysis?url=https://www.google.com
β³ Waiting for analysis to complete...
β‘ Waiting for Lighthouse JSON data (optimized timeout: 120s)...
β
Initial Lighthouse JSON data detected.
β‘ Waiting for both mobile and desktop data (optimized: 30s max)...
β
Both mobile and desktop JSON data are available!
οΏ½ Extracting available results...
οΏ½π Created screenshot directory: screenshots-20251105_143022
πΈ Capturing Full HD screenshots for mobile and desktop...
π± Switched to mobile view
β
Full HD mobile screenshot saved: screenshots-20251105_143022/fullhd_mobile_01_www.google.com.png
π₯οΈ Switched to desktop view
β
Full HD desktop screenshot saved: screenshots-20251105_143022/fullhd_desktop_01_www.google.com.png
Final URL: https://pagespeed.web.dev/analysis
π± Extracting mobile scores and metrics...
π» Extracting desktop scores and metrics...
π Performance Metrics Summary
========================================================
Metric | π± Mobile | π₯οΈ Desktop
========================================================
Performance | 89 β οΈ | 100 β
Accessibility | 95 β
| 95 β
Best Practices | 96 β
| 96 β
SEO | 91 β
| 92 β
First Contentful Paint | 1.2 s | 0.4 s
Largest Contentful Paint | 1.3 s | 0.6 s
Total Blocking Time | 120 ms | 0 ms
Cumulative Layout Shift | 0.000 | 0.000
Speed Index | 1.4 s | 0.7 s
Time to Interactive | 1.7 s | 0.8 s
First Meaningful Paint | 1.2 s | 0.4 s
========================================================
Results for https://www.google.com successfully written to pagespeed_results.csv
β
Successfully processed: https://www.google.com
β³ Waiting 7 seconds before next test...
============================================================
π Processing URL 2/2 (100.0%)
π Current URL: https://www.github.com
============================================================
οΏ½ Chrome optimized: Headless mode, performance-focused settings
Navigating to: https://pagespeed.web.dev/analysis?url=https://www.github.com
β³ Waiting for analysis to complete...
β‘ Waiting for Lighthouse JSON data (optimized timeout: 120s)...
β
Initial Lighthouse JSON data detected.
β‘ Waiting for both mobile and desktop data (optimized: 30s max)...
β
Both mobile and desktop JSON data are available!
π Extracting available results...
πΈ Capturing Full HD screenshots for mobile and desktop...
π± Switched to mobile view
β
Full HD mobile screenshot saved: screenshots-20251105_143022/fullhd_mobile_02_www.github.com.png
π₯οΈ Switched to desktop view
β
Full HD desktop screenshot saved: screenshots-20251105_143022/fullhd_desktop_02_www.github.com.png
Final URL: https://pagespeed.web.dev/analysis
π± Extracting mobile scores and metrics...
π» Extracting desktop scores and metrics...
π Performance Metrics Summary
========================================================
Metric | π± Mobile | π₯οΈ Desktop
========================================================
Performance | 62 β οΈ | 78 β οΈ
Accessibility | 83 β οΈ | 83 β οΈ
Best Practices | 78 β οΈ | 78 β οΈ
SEO | 91 β
| 92 β
First Contentful Paint | 2.1 s | 0.9 s
Largest Contentful Paint | 4.2 s | 1.8 s
Total Blocking Time | 580 ms | 280 ms
Cumulative Layout Shift | 0.095 | 0.042
Speed Index | 3.8 s | 2.1 s
Time to Interactive | 4.9 s | 2.3 s
First Meaningful Paint | 2.3 s | 1.1 s
========================================================
Results for https://www.github.com successfully written to pagespeed_results.csv
β
Successfully processed: https://www.github.com
Browser closed for URL: https://www.github.com
============================================================
π All tests completed!
π Generated files:
β’ pagespeed_results.csv - Core performance metrics and scores
πΈ screenshots-20251105_143022/ - Screenshots (4 files)
π± Mobile: 2 | π₯οΈ Desktop: 2
β
Optimized Lighthouse Analysis with Full HD Screenshots completed successfully
π HTML Dashboard Generation...
π Processing 2 unique URLs for enhanced HTML report
β
Enhanced HTML report generated: pagespeed_report.html
Open in browser: file:///Users/john/Sites/pagespeed-insights-automation/pagespeed_report.html
β
HTML Dashboard Generation completed successfully
==================================================
π WORKFLOW COMPLETED SUCCESSFULLY!
==================================================
π Generated Files:
π pagespeed_results.csv - Core performance metrics and scores
π― pagespeed_report.html - Performance dashboard
πΈ screenshots-20251105_143022/ - Full HD Screenshots (4 files)
π± Mobile: 2 | π₯οΈ Desktop: 2
π Open HTML report in browser? (y/n): y
β
HTML report opened in browser
π Open Full HD screenshot directory? (y/n): y
β
Screenshot directory opened: screenshots-20251105_143022
π‘ Next Steps:
β’ Review the performance dashboard for visual insights
β’ Import CSV data into Excel/Google Sheets for further analysis
β’ Check Full HD screenshot files for complete page verification
β’ Focus on URLs with Core Web Vitals issues
β’ Re-run analysis after implementing optimizationsEdit main.py to adjust delays between requests:
delay = random.randint(5, 10) # 5-10 second random delayModify the CSV filename in main.py:
write_to_csv(page_speed_scores, "custom_filename.csv")Enable/disable screenshots in the workflow:
# In run_analysis.py - interactive prompt
πΈ Enable Full HD full-page screenshot capture? (Y/n): Y
# Or pass directly to main.py
enable_screenshots = True # Set to False to disableThe tool runs in optimized headless mode by default. To modify browser settings, edit main.py:
# Browser is automatically configured for optimal performance
# Headless mode is enabled by default for better performance
options.add_argument("--headless") # Already enabled for optimizationChromeDriver Issues:
- The tool auto-downloads ChromeDriver
- Ensure Chrome browser is installed
- Try updating Chrome to the latest version
Timeout Errors:
- Increase timeout values in
main.py - Check internet connection stability
- Some websites may take longer to analyze
Rate Limiting:
- Increase delays between requests
- Use proxy rotation for large batches
- Respect Google's terms of service
Missing Dependencies:
# Manual installation of all current dependencies
pip install selenium webdriver-manager fake-useragent pandas openpyxl
# Or re-run the automated setup script
./setup.shScreenshot Issues:
- Ensure sufficient disk space for Full HD screenshots
- Check write permissions in the project directory
- Screenshots require successful Lighthouse analysis completion
- If screenshots fail, analysis will continue normally
Setup Issues: If you encounter any setup problems, try the following steps:
- Run the enhanced setup script:
chmod +x setup.sh
./setup.sh- Validate your setup:
python validate_setup.pyThis will check all components and provide detailed diagnostics.
- Manual dependency installation:
# Activate virtual environment first
source .venv/bin/activate # macOS/Linux
# or
.venv\Scripts\activate # Windows
# Install/reinstall dependencies
pip install --force-reinstall -r requirements.txtThe validation script will identify specific issues and provide targeted solutions.
- Start with small batches (10-20 URLs)
- Use longer delays (15-30 seconds) between requests
- Run during off-peak hours to avoid rate limiting
- Monitor for rate limiting and adjust delays accordingly
- Consider disabling screenshots for very large batches to save time and space
- Ensure adequate disk space (approximately 300-400 KB per URL)
- Use screenshots for important analyses and client deliverables
- Full HD screenshots are ideal for presentations and documentation
- Screenshots can be disabled for routine monitoring to improve speed
- Test the same URLs multiple times for consistency
- Compare results across different time periods
- Consider geographic location differences in CDN performance
- Account for caching effects and server load variations
- Random user agents for each browser session
- Disabled automation flags and detection bypassing
- Navigator.webdriver property masking
- Configurable request delays between URL processing
- Optimized headless browser operation
- Performance-focused Chrome settings to avoid detection
lighthouse-automation-suite/
βββ main.py # Core automation script with screenshot support
βββ urls.txt # URLs to analyze (supports comments)
βββ setup.sh # π Automated setup script (recommended)
βββ generate_html_report.py # π Performance dashboard generator
βββ run_analysis.py # π Complete workflow runner (recommended)
βββ requirements.txt # Python dependencies
βββ packages.txt # System dependencies
βββ README.md # Project documentation
βββ CORE_WEB_VITALS_UPDATE.md # Latest feature updates (October 2025)
βββ .gitignore # Git ignore rules
βββ pagespeed_results.csv # π Performance results (gitignored)
βββ pagespeed_report.html # π¨ Performance dashboard (gitignored)
βββ screenshots-YYYYMMDD_HHMMSS/ # πΈ Full HD screenshots (gitignored)
- Fork the repository
- Create a feature branch
- Make your improvements
- Test thoroughly
- Submit a pull request
This project is open source. Use responsibly and respect Google's terms of service.
- This tool is for educational and legitimate business use only
- Respect rate limits and terms of service
- Consider the impact on PageSpeed Insights service
- Use delays between requests to be respectful
- Monitor your usage to avoid being blocked
If you encounter issues:
- Check the troubleshooting section
- Verify all dependencies are installed
- Ensure URLs in
urls.txtare valid - Check internet connectivity
- Review console output for specific error messages
- β πΈ Full HD Screenshot Support - Optional mobile and desktop screenshots
- β π― Optimized Performance - 40% faster processing with reduced wait times
- β π₯οΈ Professional Quality - 1920px Full HD screenshots with complete page capture
- β π Organized Output - Timestamped screenshot directories
- β π Streamlined Integration - Single script with all functionality
- β π Tabbed interface with Performance Overview, Optimization Opportunities, and Accessibility Issues
- β π§Ή Clean CSV structure - Main CSV no longer contains internal fields
- β π Separate detail files - Dedicated CSV files for optimization, accessibility, and SEO insights
- β π¨ Enhanced UI/UX - Fixed tab hover states, 4-column grid layout, professional styling
- β π Core Web Vitals matrix - Detailed performance metrics in Performance Overview tab
- β
π Backward compatibility - Existing
pagespeed_results.csvworkflows unchanged
- β Color-coded HTML dashboard with Google performance thresholds
- β Green/Orange/Red indicators for instant performance identification
- β Professional styling with responsive design
- β Enhanced URL validation with detailed reporting
- β Cross-platform compatibility with dynamic paths
See CORE_WEB_VITALS_UPDATE.md for detailed information about all enhancements.
Happy Analyzing! π