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>
37 lines
1.2 KiB
Markdown
37 lines
1.2 KiB
Markdown
---
|
|
name: cdp_evaluate
|
|
kind: function
|
|
lang: go
|
|
domain: browser
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func CdpEvaluate(c *CDPConn, expression string) (string, error)"
|
|
description: "Ejecuta una expresion JavaScript arbitraria en la pagina actual via Runtime.evaluate. Retorna el resultado serializado como string. Soporta await (awaitPromise=true). Reporta excepciones JS como error."
|
|
tags: [chrome, cdp, browser, automation, javascript, devtools]
|
|
uses_functions: [cdp_connect_go_browser]
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt]
|
|
tested: true
|
|
tests: ["TestCdpEvaluate"]
|
|
test_file_path: "functions/infra/chrome_launch_test.go"
|
|
file_path: "functions/infra/cdp_evaluate.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
conn, _ := CdpConnect(9222)
|
|
result, err := CdpEvaluate(conn, "document.title")
|
|
// result = "My Page Title"
|
|
|
|
sum, err := CdpEvaluate(conn, "1 + 2")
|
|
// sum = "3"
|
|
```
|
|
|
|
## Notas
|
|
|
|
Los valores no-string se convierten con `fmt.Sprintf("%v", value)`. Numeros aparecen sin decimales si son enteros (ej: `"3"` no `"3.0"`). Para tipos complejos (objetos, arrays), el resultado es la representacion Go de la interfaz, no JSON — usar `JSON.stringify(...)` en la expresion JS para obtener JSON limpio.
|