Skip to content

Commit d5cd3dc

Browse files
authored
[Browser Run] Correct session recording response schema (#33164)
1 parent 73d22ac commit d5cd3dc

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

‎src/content/docs/browser-run/features/session-recording.mdx‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ When browser automation fails or behaves unexpectedly, it can be difficult to un
1717

1818
## Enable session recording
1919

20+
Session recording must be enabled during the initial session acquisition. You cannot enable recording when reconnecting to an existing session.
21+
2022
Pass `recording: true` to `puppeteer.launch()` or `playwright.launch()`:
2123

2224
<Tabs>
@@ -131,20 +133,25 @@ A successful response looks similar to the following:
131133

132134
```json
133135
{
134-
"sessionId": "e26d4660-5b78-4761-b82f-c6b5bad5a925",
135-
"duration": 4380,
136-
"events": {
137-
"target-1": [],
138-
"target-2": []
136+
"success": true,
137+
"result": {
138+
"sessionId": "e26d4660-5b78-4761-b82f-c6b5bad5a925",
139+
"duration": 4380,
140+
"events": {
141+
"target-1": [],
142+
"target-2": []
143+
}
139144
}
140145
}
141146
```
142147

143-
The keys in `events` (such as `target-1`, `target-2`) are [CDP targets](https://chromedevtools.github.io/devtools-protocol/tot/Target/). In the context of session recording, each target typically corresponds to a browser tab. A session that opened multiple tabs will have one target per tab, and each target's value is an independent rrweb event array for that tab.
148+
After a recorded session closes, the recording may still be finalizing. The endpoint can briefly return `404` during this period. Callers can retry the request until finalization completes.
149+
150+
The event arrays are available under `result.events`. The keys in `result.events` (such as `target-1`, `target-2`) are [CDP targets](https://chromedevtools.github.io/devtools-protocol/tot/Target/). In the context of session recording, each target typically corresponds to a browser tab. A session that opened multiple tabs will have one target per tab, and each target's value is an independent rrweb event array for that tab.
144151

145152
## Replay a recording
146153

147-
Each value in `events` is a standard rrweb event array and can be passed directly to [`rrweb-player`](https://github.com/rrweb-io/rrweb/tree/master/packages/rrweb-player) to self-host a replay UI with a timeline scrubber and playback controls.
154+
Each value in `result.events` is a standard rrweb event array and can be passed directly to [`rrweb-player`](https://github.com/rrweb-io/rrweb/tree/master/packages/rrweb-player) to self-host a replay UI with a timeline scrubber and playback controls.
148155

149156
Tabs replay independently — to replay a multi-tab session, render one player per target, or build a UI that lets the user switch between targets (similar to the tab selector in the dashboard recording viewer).
150157

0 commit comments

Comments
 (0)