bf1efb2099
- 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>
43 lines
1.3 KiB
Markdown
43 lines
1.3 KiB
Markdown
---
|
|
name: cdp_click
|
|
kind: function
|
|
lang: go
|
|
domain: browser
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func CdpClick(c *CDPConn, selector string) error"
|
|
description: "Hace click en el primer elemento que coincide con el selector CSS. Obtiene coordenadas del centro via getBoundingClientRect, hace scroll al elemento y despacha eventos mousedown+mouseup via Input.dispatchMouseEvent."
|
|
tags: [chrome, cdp, browser, automation, click, dom, devtools]
|
|
uses_functions: [cdp_connect_go_browser, cdp_evaluate_go_browser]
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt, strconv, strings]
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "functions/infra/cdp_click.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
conn, _ := CdpConnect(9222)
|
|
CdpNavigate(conn, "https://example.com")
|
|
|
|
// Click en el primer enlace
|
|
if err := CdpClick(conn, "a"); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
// Click en boton por ID
|
|
if err := CdpClick(conn, "#submit-btn"); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
```
|
|
|
|
## Notas
|
|
|
|
El selector sigue la sintaxis CSS estandar (IDs, clases, atributos, pseudo-selectores). El elemento debe ser visible en el DOM en el momento del click. Si no se encuentra, retorna error inmediatamente sin esperar — combinar con `CdpWaitElement` para elementos dinamicos.
|