Skip to content

Commit 33657d8

Browse files
authored
Resolve CDP tailing docs conflicts (#60)
1 parent c7a2ed5 commit 33657d8

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

skills/browser/REFERENCE.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,61 @@ browse network clear
393393
394394
---
395395
396+
### CDP Event Tailing
397+
398+
#### `cdp <url|port>`
399+
400+
Attach to any Chrome DevTools Protocol target and stream events as NDJSON (one JSON object per line). This command bypasses the daemon entirely — it opens a direct WebSocket connection and runs until interrupted.
401+
402+
```bash
403+
browse cdp 9222 # bare port — auto-discovers via /json/version
404+
browse cdp ws://127.0.0.1:9222/devtools/browser/... # full WebSocket URL
405+
browse cdp wss://connect.browserbase.com/debug/... # remote Browserbase debug URL
406+
```
407+
408+
**Options:**
409+
410+
| Flag | Description |
411+
|------|-------------|
412+
| `--domain <domains...>` | CDP domains to enable (repeatable). Default: Network, Console, Runtime, Log, Page |
413+
| `--pretty` | Human-readable output instead of JSON. Auto-enabled for TTY |
414+
415+
**Default domains:** Network, Console, Runtime, Log, Page. To capture only specific domains:
416+
417+
```bash
418+
browse cdp 9222 --domain Network # network events only
419+
browse cdp 9222 --domain Network --domain Console # network + console
420+
```
421+
422+
**Piping and filtering:**
423+
424+
```bash
425+
browse cdp 9222 > events.jsonl # save to file
426+
browse cdp 9222 | jq '.method' # extract method names
427+
browse cdp 9222 | jq 'select(.method == "Network.requestWillBeSent") | .params.request.url'
428+
```
429+
430+
**Pretty output** shows compact one-line summaries:
431+
432+
```
433+
[Target.attachedToTarget] [page] https://example.com
434+
[Network.requestWillBeSent] GET https://example.com/api/data
435+
[Network.responseReceived] 200 https://example.com/api/data
436+
[Runtime.consoleAPICalled] [log] Hello world
437+
[Page.frameNavigated] https://example.com/about
438+
```
439+
440+
**With Browserbase sessions:** Use `bb sessions debug <session-id>` to get the `wsUrl`, then pass it to `browse cdp`:
441+
442+
```bash
443+
# Get the debug WebSocket URL
444+
bb sessions debug <session-id>
445+
# Copy the wsUrl field and pass it to browse cdp
446+
browse cdp wss://connect.browserbase.com/debug/<session-id>/devtools/browser/...
447+
```
448+
449+
---
450+
396451
## Configuration
397452
398453
### Common Flags

skills/browser/SKILL.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ browse is checked <selector> # Check if element is checked
9494
browse wait <type> [arg] # Wait for: load, selector, timeout
9595
```
9696
97+
### CDP event tailing
98+
```bash
99+
browse cdp <url|port> # Stream CDP events as NDJSON from any target
100+
browse cdp 9222 # Attach to local Chrome on port 9222
101+
browse cdp ws://localhost:9222/devtools/browser/... # Full WebSocket URL
102+
browse cdp <url> --domain Network # Only Network events
103+
browse cdp <url> --domain Network --domain Console # Multiple domains
104+
browse cdp <url> --pretty # Human-readable output
105+
browse cdp <url> > events.jsonl # Pipe to file
106+
browse cdp <url> | jq '.method' # Filter with jq
107+
```
108+
109+
The `cdp` command connects directly to any Chrome DevTools Protocol target and streams events. It does **not** use the daemon — it's a standalone, long-running process. Press Ctrl+C to stop. Default domains: Network, Console, Runtime, Log, Page.
110+
97111
### Session management
98112
```bash
99113
browse stop # Stop the browser daemon

0 commit comments

Comments
 (0)