Record a Session to inspect the actions performed and network requests
New: Browserbase now uses video-based session recordings instead of DOM-based replays. Session recordings capture up to 10 tabs as separate video streams, providing more reliable playback and better support for dynamic content. This replaces our previous RRWeb implementation. Read more here.
Session Recordings are one of the most powerful features of Browserbase. It allows you to record a Session to inspect the actions performed and network requests, page by page.To learn more about how Session Recordings works, we’ll walk through a quickstart guide to understand how Session Recordings can be involved in your development workflow.Let’s get started in viewing your first session recording immediately.
A recording of each Session is featured in the Sessions page. This recording is a video recording of the session and can be inspected with your Chrome DevTools.
Here are some key takeaways:
A high usage of memory or CPUs might result in longer runs and more billed minutes. Look at the logs or open a Live Session URL to pinpoint the root issue.
In case of high proxy bandwidth usage, inspect the network requests using the Timeline described below.
The DOM tab shows a live representation of the webpage’s HTML structure during the session.You can inspect the Document Object Model DOM to see the exact state of elements, their attributes, and how they’re nested within the page.
Logs emitted by the Web Console API (ex: console.log()), making debugging remote Sessions as easy as using your browser
Some example of console logs:
browser-solving-started
browser-solving-completed
browserbase-keeping-connection-alive
Starting recording
You’ll also be able to see other logs as expected from a browser, like [DOM] Updated style of [body] or [Network] Request finished loading: GET "https://example.com/style.css"
Network events (Network), describing in detail any network requests and responses performed during SessionThe Timeline also features logs emitted by the Web Console API (ex: console.log()),
making debugging remote Sessions as easy as using your browser.
Logs can also be retrieved using the Sessions
API for automated processing.
HAR (HTTP Archive) files capture detailed network activity during your browser sessions. You can record HAR files using Playwright’s tracing feature, which provides comprehensive network data that can be analyzed or replayed.
Network Requests: All HTTP requests made during the session
Response Data: Complete response bodies and headers
Timing Information: Detailed timing for each network operation
Performance Metrics: Network performance and loading times
When using Browserbase’s remote browsers, HAR files created with routeFromHAR are stored on the remote instance. Use tracing to capture network data locally for analysis.
Session logs contain detailed information captured during a Browserbase session. This includes browser events, network requests, and other runtime data.These logs provide insights into what occurred during the session’s execution.To retrieve the logs of a session, you can use the Sessions API or the logs.list() method in the Browserbase SDK.
Node.js
Python
Copy
Ask AI
// Get the session logs for the given session idconst logs = await bb.sessions.logs.list(session.id);console.log(logs);
Copy
Ask AI
# Get the session logs for the given session idlogs = bb.sessions.logs.list(session.id)print(logs)
These logs retrieved using the Browserbase SDK are the same as the ones
featured in the Events tab of the Session Recording.
Let’s say you have a session ID and you want to retrieve the replays for that session. You can do so by using the recording.retrieve() method in the Browserbase SDK.
The retrieve method returns the session recording events, which can be used to replay the session. This uses the rrweb player to replay the session, this does not work with video recordings.
Node.js
Python
Copy
Ask AI
// Get the session replay for the given session idconst rrwebEvents = await bb.sessions.recording.retrieve(session.id);console.log(rrwebEvents);
Copy
Ask AI
# Get the session replay for the given session idrrwebEvents = bb.sessions.recording.retrieve(session.id)print(rrwebEvents)
Often times, you’ll want to integrate a recording player in your application. This is a simple process that can be done in a few steps.Since session recordings are a culmination of rrweb events captured during the session, you can integrate a recording player into your application to replay these events.
If using a frontend framework like Next.js, you can use the rrwebPlayer component for displaying the session replay in your application.You can create a reusable component that accepts session recording events as props and renders the rrweb player:
Copy
Ask AI
import rrwebPlayer from "rrweb-player";import "rrweb-player/dist/style.css";// Initialize the player with your session recordingnew rrwebPlayer({ target: document.body, props: { events: recording.events, width: 1024, height: 576, },});
The iframe approach requires you to host a separate page that initializes the
rrweb player. Make sure to handle proper session authentication and access
control.