750b7abcd5
- .claude/CLAUDE.md - .claude/agents/fn-recopilador/SKILL.md - .claude/rules/INDEX.md - .claude/rules/cpp_apps.md - bash/functions/infra/build_cpp_windows.sh - cpp/CMakeLists.txt - cpp/PATTERNS.md - cpp/framework/app_base.cpp - cpp/framework/app_base.h - dev/issues/README.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
43 lines
1.6 KiB
Markdown
43 lines
1.6 KiB
Markdown
---
|
|
name: cdp_new_tab
|
|
kind: function
|
|
lang: go
|
|
domain: browser
|
|
version: 0.1.0
|
|
purity: impure
|
|
signature: "func CdpNewTab(host string, port int, startURL string) (CdpTab, error)"
|
|
description: "Abre una pestaña nueva via /json/new. Si startURL es vacio Chrome abre about:blank. Retorna el CdpTab recien creado con su id, webSocketDebuggerUrl, etc. Compatible con Chrome 126+ (PUT) y anteriores (fallback GET)."
|
|
tags: [browser, cdp, tabs, spawn]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [encoding/json, fmt, net/http, net/url]
|
|
example: |
|
|
tab, err := browser.CdpNewTab("localhost", 9222, "https://example.com")
|
|
if err == nil {
|
|
fmt.Println("nueva tab id=", tab.ID)
|
|
}
|
|
tested: true
|
|
tests: ["TestCdpNewTab_emptyURLOk"]
|
|
test_file_path: "functions/browser/cdp_list_tabs_test.go"
|
|
file_path: "functions/browser/cdp_list_tabs.go"
|
|
notes: |
|
|
- Definida en mismo archivo que CdpListTabs — comparten estructura.
|
|
- Desde Chrome 126 el endpoint requiere PUT. Mantenemos fallback a GET por compatibilidad.
|
|
- URL se codifica como query string raw (no clave=valor — formato historico de Chrome).
|
|
documentation: |
|
|
Util para abrir tabs de scraping bajo control programatico sin pasar por
|
|
WebSocket. Combina con CdpListTabs para enumerar antes/despues, y
|
|
CdpCloseTab para limpiar al final.
|
|
params:
|
|
- name: host
|
|
desc: "Host CDP (vacio = localhost)."
|
|
- name: port
|
|
desc: "Puerto remote-debugging."
|
|
- name: startURL
|
|
desc: "URL inicial. Vacio = about:blank."
|
|
output: "CdpTab del target recien creado (id, websocket url, ...). Error si HTTP falla."
|
|
---
|