add09c2faa
10 funciones Go en infra/ para controlar Chrome via Chrome DevTools Protocol: chrome_launch, cdp_connect, cdp_navigate, cdp_evaluate, cdp_screenshot, cdp_click, cdp_type_text, cdp_wait_element, cdp_get_html, cdp_close. WebSocket RFC 6455 implementado sin dependencias externas. Incluye tests de integración con Chrome real. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.2 KiB
1.2 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cdp_screenshot | function | go | infra | 1.0.0 | impure | func CdpScreenshot(c *CDPConn, outputPath string, opts CdpScreenshotOpts) error | Captura un screenshot de la pagina actual via Page.captureScreenshot y lo guarda en el archivo indicado. Soporta PNG y JPEG, viewport o pagina completa. Crea el directorio destino si no existe. |
|
|
false | error_go_core |
|
true |
|
functions/infra/chrome_launch_test.go | functions/infra/cdp_screenshot.go |
Ejemplo
conn, _ := CdpConnect(9222)
CdpNavigate(conn, "https://example.com")
err := CdpScreenshot(conn, "/tmp/page.png", CdpScreenshotOpts{
FullPage: true,
Format: "png",
})
Notas
El struct CdpScreenshotOpts tiene campos: FullPage bool, Quality int (JPEG), Format string ("png" o "jpeg"). Chrome retorna la imagen como base64 que se decodifica y escribe al disco.