Files
fn_registry/functions/browser/chrome_launch.md
T
egutierrez d7f2c00d7b feat: externalize apps/analysis to Gitea repos, add analysis table
- 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>
2026-04-01 04:23:51 +02:00

1.5 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
chrome_launch function go browser 1.0.0 impure func ChromeLaunch(opts ChromeLaunchOpts) (int, error) 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.
chrome
cdp
browser
automation
wsl2
headless
false error_go_core
fmt
net
os
os/exec
time
true
TestFindChrome
TestChromeLaunchAndConnect
functions/infra/chrome_launch_test.go functions/infra/chrome_launch.go

Ejemplo

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.