Skip to content
cueva.dev
← All work

Water treatment company · 2026

Automated PageSpeed testing

A tool that turns noisy PageSpeed scores into data you can average.

Skills
Stack
Python · Playwright · openpyxl
One run
  1. 01Open PageSpeed Insights
  2. 02Dismiss cookie banner
  3. 03Wait for mobile and desktop scores
  4. 04Retry on Google errors
  5. 05Save debug files on timeout
  6. 06Write a row to Excel
Sample outputIllustrative numbers, not client data. One row per run, averaged at the end.
RunMobile perf.Desktop perf.AccessibilityBest practicesSEO
1719496100100
2789696100100
3749596100100
4699396100100
5769796100100
Average73.695.096.0100.0100.0

Context

PageSpeed Insights scores move from run to run, so a single test can’t prove that an optimization worked.

What I did

  • Wrote a Python + Playwright tool that runs pagespeed.web.dev repeatedly against a URL, with randomized waits between runs.
  • Captures mobile and desktop scores for all four Lighthouse categories on every run.
  • Handles the real-world mess: dismisses the cookie banner, detects Google’s transient errors and retries with backoff, and saves debug HTML and screenshots when a run times out.
  • Writes one row per run to Excel, ready for averages and pivot tables.

Outcome

Before/after performance comparisons based on averaged runs instead of one lucky score.