scripts/puppeteer/QUICK-REFERENCE.md
One-page reference for AI agents using Puppeteer with docs-v2.
# 1. Hugo server must be running
npx hugo server
# 2. Packages installed (one-time)
PUPPETEER_SKIP_DOWNLOAD=true yarn install
yarn debug:screenshot <path> # Basic screenshot
yarn debug:screenshot <path> --full-page # Full scrollable page
yarn debug:screenshot <path> --selector .class # Specific element
yarn debug:screenshot <path> --viewport 375x667 # Mobile size
yarn debug:inspect <path> # Full analysis
yarn debug:inspect <path> --output report.json # Save report
yarn debug:inspect <path> --screenshot # Include screenshot
yarn debug:browser <path> # Interactive mode
yarn debug:browser <path> --devtools # With DevTools
yarn debug:browser <path> --slow-mo 500 # Slow motion
yarn debug:screenshot /path/to/page/ --full-page
yarn debug:inspect /path/to/page/
# Review screenshot and inspection report
# Before
yarn debug:screenshot /example/ --output before.png
# Make changes, restart Hugo
# After
yarn debug:screenshot /example/ --output after.png
yarn debug:inspect /path/ # Check errors section
yarn debug:browser /path/ --devtools # Debug in browser
yarn debug:inspect /path/ --output perf.json
# Check perf.json → performance.performance.loadComplete
# Should be < 3000ms
node scripts/puppeteer/examples/detect-issues.js /path/
import {
launchBrowser,
navigateToPage,
takeScreenshot,
elementExists,
getPageMetrics,
} from './utils/puppeteer-helpers.js';
const browser = await launchBrowser();
const page = await navigateToPage(browser, '/influxdb3/core/');
// Check element
const hasComponent = await elementExists(page, '[data-component="format-selector"]');
// Screenshot
await takeScreenshot(page, 'debug.png');
// Performance
const metrics = await getPageMetrics(page);
console.log('Load time:', metrics.performance.loadComplete);
await browser.close();
--chrome PATH # Use system Chrome
--base-url URL # Different base URL
--viewport WxH # Viewport size
--output PATH # Output file path
--full-page # Full page screenshot
--selector CSS # Element selector
--screenshot # Include screenshot
--devtools # Open DevTools
--slow-mo NUM # Slow down actions
# Find Chrome
which google-chrome
# Use with flag
yarn debug:browser /path/ --chrome "$(which google-chrome)"
# Check if running
curl -s http://localhost:1313/
# Start if needed
npx hugo server
# Install without downloading Chrome
PUPPETEER_SKIP_DOWNLOAD=true yarn install
launchBrowser(options) - Launch browsernavigateToPage(browser, path, options) - NavigateclickAndNavigate(page, selector) - Click & waittakeScreenshot(page, path, options) - Capture screenshotcompareScreenshots(baseline, current, diff) - Compare imagestestResponsive(page, viewports, testFn) - Multi-viewportelementExists(page, selector) - Check existswaitForElement(page, selector, timeout) - WaitgetElementText(page, selector) - Get textgetPageMetrics(page) - Performance datagetPageLinks(page) - All linksgetComputedStyles(page, selector) - CSS valuesdebugPage(page, name) - Save HTML + screenshot + logscaptureConsoleLogs(page) - Capture consoleLook for: {{<, {{%, {{.
yarn debug:inspect /path/
# Check: report.shortcodeRemnants
yarn debug:inspect /path/
# Check: report.errors
yarn debug:inspect /path/
# Check: report.performance.performance.loadComplete < 3000ms
# Check: report.performance.performance.firstContentfulPaint < 1500ms
yarn debug:inspect /path/
# Check: report.accessibility
# - hasMainLandmark
# - hasH1
# - imagesWithoutAlt
# - linksWithoutText
yarn debug:inspect /path/
# Check: report.components
# Lists all [data-component] elements
All in scripts/puppeteer/examples/:
test-format-selector.js - Test interactive componentdetect-issues.js - Automated issue detectionRun with:
node scripts/puppeteer/examples/detect-issues.js /path/
scripts/puppeteer/README.mdscripts/puppeteer/SETUP.mdscripts/puppeteer/QUICK-REFERENCE.mdWhen something's broken and you need full context:
yarn debug:inspect /path/ --output emergency.json --screenshot
yarn debug:screenshot /path/ --full-page --output emergency-full.png
yarn debug:browser /path/ --devtools
This gives you:
Remember: Always start Hugo server first! (npx hugo server)