| cdp_list_tabs |
function |
go |
browser |
0.1.0 |
impure |
func CdpListTabs(host string, port int) ([]CdpTab, error) |
Lista las pestañas/targets de una instancia Chrome via GET /json. Sin websocket — solo HTTP. Util para apps que muestran el inventario de pestañas (dashboards, debuggers) o agentes que iteran tabs sin tener que abrir conexion CDP a cada una. |
| browser |
| cdp |
| tabs |
| listing |
| http |
|
|
|
|
false |
error_go_core |
| encoding/json |
| fmt |
| net/http |
| net/url |
|
tabs, err := browser.CdpListTabs("localhost", 9222)
if err == nil {
for _, t := range tabs {
if t.Type == "page" {
fmt.Println(t.ID, t.Title, t.URL)
}
}
}
|
true |
| TestCdpListTabs_emptyHost |
|
functions/browser/cdp_list_tabs_test.go |
functions/browser/cdp_list_tabs.go |
- Endpoint CDP es read-only HTTP, no requiere CdpConnect.
- Retorna TODOS los targets (page + iframe + service_worker + ...). Filtrar por type segun caso de uso.
- Tipo `CdpTab` es publico — apps externas pueden consumirlo.
- Mismo archivo expone CdpNewTab, CdpCloseTab, CdpActivateTab — operaciones HTTP /json/* relacionadas.
|
Wraps el endpoint clasico de Chrome DevTools Protocol /json. Misma estructura
que devuelve `chrome://inspect/#devices` o que consumen Puppeteer/Playwright
cuando se conectan a un Chrome existente.
|
| name |
desc |
| host |
Host CDP (vacio = localhost). |
|
| name |
desc |
| port |
Puerto remote-debugging. |
|
|
Slice de CdpTab (id, type, title, url, webSocketDebuggerUrl). Error si HTTP falla o status != 200. |