Loading...
Loading...
Compare original and translation side by side
WebSocketnode "${SKILL_DIR}/scripts/full-page-screenshot.mjs" --checkchrome://inspect/#remote-debuggingWebSocketnode "${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" --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
node "${SKILL_DIR}/scripts/full-page-screenshot.mjs" --url "https://example.com" /tmp/screenshot.png --width 1200 --dpr 1 --wait 15000注意:模式会创建后台标签页。需要认证的页面(SSO、登录墙)应使用选项A。--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) | — |
| 参数 | 说明 | 默认值 |
|---|---|---|
| 输出PNG文件路径 | |
| 视口宽度(CSS像素,文章类页面建议1200,仪表盘类建议1440-1920) | 1200 |
| 设备像素比(2=视网膜屏,但文件大小会变为4倍) | 1 |
| 页面加载超时时间(仅 | 15000 |
| 捕获前注入的自定义CSS(例如隐藏元素) | — |
undefinedundefinedundefinedundefinedoverflow-y: auto/scrollh-[calc(...)]readyState=completeIntersectionObserver<img>DevToolsActivePort/eval/screenshot/scrolloverflow-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 up1. 发现Chrome调试端口
2. 通过WebSocket连接CDP
3. 附加到目标标签页/创建后台标签页
4. 通过Emulation域设置视口宽度
5. 等待:页面就绪 + DOM稳定
6. 检测并扩展滚动容器
7. 滚动页面(触发懒加载)
8. 等待图片加载完成
9. 测量最终内容高度
10. 执行Page.captureScreenshot(或分片捕获)
11. 若需要则拼接分片(使用PIL)
12. 恢复视口、断开连接、清理资源| 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 |
| 请勿这样做 | 建议做法 |
|---|---|
对高度超过10000px的页面使用 | 使用 |
对需认证/SSO的页面使用 | 在用户已登录的标签页上使用 |
为SPA页面设置 | SPA需要时间获取数据并渲染,建议设置10000-15000毫秒 |
未先执行 | 始终先验证Chrome调试是否可用 |
| 为所有页面硬编码视口宽度 | 文章类页面用1200,仪表盘/表格类用1440+ |
| 跳过输出结果验证 | 捕获后务必用 |
| 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 |
| 症状 | 原因 | 解决方法 |
|---|---|---|
| "无法找到Chrome调试端口" | 未开启远程调试 | 打开 |
| "WebSocket连接超时" | CDP代理持有连接 | 脚本会自动降级使用代理API |
| 截图空白/白屏 | 页面未加载完成 | 增大 |
| 截图底部被截断 | 滚动容器未扩展 | 脚本会自动处理此问题,若仍存在请提交issue |
| 内存不足 | 超长页面+高DPR | 将 |
| "PIL不可用于拼接分片" | 未安装Python Pillow | 执行 |
engineering/browser-automationengineering/performance-profilerengineering/browser-automationengineering/performance-profiler