Loading...
Loading...
Use when the user asks to capture a full-page screenshot, long screenshot, or complete page capture of a web page. Handles SPA scroll containers, lazy-loaded images, and very tall pages via Chrome DevTools Protocol with zero external dependencies.
npx skill4agent add alirezarezvani/claude-skills full-page-screenshotWebSocketnode "${SKILL_DIR}/scripts/full-page-screenshot.mjs" --checkchrome://inspect/#remote-debuggingnode "${SKILL_DIR}/scripts/full-page-screenshot.mjs" --listnode "${SKILL_DIR}/scripts/full-page-screenshot.mjs" <targetId> /tmp/screenshot.png --width 1200 --dpr 1node "${SKILL_DIR}/scripts/full-page-screenshot.mjs" --url "https://example.com" /tmp/screenshot.png --width 1200 --dpr 1 --wait 15000Note:mode creates a background tab. Pages requiring authentication (SSO, login walls) should use Option A instead.--url
| Parameter | Description | Default |
|---|---|---|
| Output PNG file path | |
| Viewport width in CSS pixels (articles: 1200, dashboards: 1440-1920) | 1200 |
| Device pixel ratio (2 = Retina, but 4x file size) | 1 |
| Page load timeout in ms ( | 15000 |
| Custom CSS to inject before capture (e.g., hide elements) | — |
# macOS
sips -g pixelWidth -g pixelHeight /tmp/screenshot.png
# Linux
file /tmp/screenshot.pngoverflow-y: auto/scrollh-[calc(...)]readyState=completeIntersectionObserver<img>DevToolsActivePort/eval/screenshot/scroll1. Discover Chrome debugging port
2. Connect via WebSocket (CDP)
3. Attach to target / create background tab
4. Set viewport width via Emulation domain
5. Wait: readyState + DOM stability
6. Detect & expand scroll containers
7. Scroll through page (trigger lazy-load)
8. Wait for images to complete
9. Measure final content height
10. Page.captureScreenshot (or tiled capture)
11. Stitch tiles if needed (PIL)
12. Restore viewport, detach, clean up| Do NOT | Do instead |
|---|---|
Use | Use |
Use | Use |
Set | SPAs need time to fetch data and render; use 10000-15000 |
Capture without checking | Always verify Chrome debugging is available |
| Hardcode viewport widths for all pages | Use 1200 for articles, 1440+ for dashboards/tables |
| Skip output verification | Always verify with |
| Symptom | Cause | Fix |
|---|---|---|
| "Cannot find Chrome debugging port" | Remote debugging not enabled | Open |
| "WebSocket connection timeout" | CDP proxy holding the connection | Script auto-falls back to proxy API |
| Blank/white screenshot | Page not loaded yet | Increase |
| Truncated at bottom | Scroll container not expanded | Script handles this automatically; file an issue if it persists |
| Out of memory | Very tall page + high DPR | Reduce |
| "PIL not available for stitching" | Python Pillow not installed | Install with |
engineering/browser-automationengineering/performance-profiler