d7f2c00d7b
- Migration 007: repo_url on apps table + analysis table with FTS5 - Analysis struct, parser, CRUD, validation, hash computation - Selective purge: remote-only apps/analysis preserved across fn index - CLI: fn app list/clone/pull, fn analysis list/clone/pull - search/show/list now include analysis results - Apps removed from git tracking (content lives in Gitea repos) - .gitkeep for apps/ and analysis/ dirs - Bash functions: jupyter analysis pipeline, shell utilities - Browser domain: CDP functions moved from infra to browser Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.5 KiB
Markdown
48 lines
1.5 KiB
Markdown
---
|
|
name: chrome_launch
|
|
kind: function
|
|
lang: go
|
|
domain: browser
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func ChromeLaunch(opts ChromeLaunchOpts) (int, error)"
|
|
description: "Lanza Google Chrome con remote debugging habilitado en el puerto indicado. Busca chrome.exe en PATH (WSL2) o en rutas conocidas de Windows. Espera hasta 15s a que el puerto CDP este listo antes de retornar. Retorna el PID del proceso."
|
|
tags: [chrome, cdp, browser, automation, wsl2, headless]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt, net, os, os/exec, time]
|
|
tested: true
|
|
tests: ["TestFindChrome", "TestChromeLaunchAndConnect"]
|
|
test_file_path: "functions/infra/chrome_launch_test.go"
|
|
file_path: "functions/infra/chrome_launch.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
pid, err := ChromeLaunch(ChromeLaunchOpts{
|
|
Port: 9222,
|
|
UserDataDir: "/tmp/chrome-cdp",
|
|
Headless: true,
|
|
})
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
defer CdpClose(nil, pid)
|
|
```
|
|
|
|
## Notas
|
|
|
|
Busca Chrome en este orden:
|
|
1. `chrome.exe` en PATH (disponible en WSL2 si Windows lo tiene en PATH)
|
|
2. `google-chrome` / `chromium-browser` / `chromium` (Linux nativo)
|
|
3. `/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`
|
|
4. `/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`
|
|
|
|
Los flags aplicados desactivan funcionalidades de red y actualizacion en segundo plano para entornos de automatizacion. En modo headless se agrega `--headless=new --disable-gpu`.
|
|
|
|
El struct `ChromeLaunchOpts` se define en el mismo archivo.
|