Session termination
Browser sessions can end in these ways:- Automatic timeout Sessions have a default timeout configured at the project level, which can be customized when creating a session. For longer-running tasks, enable keep alive.
-
Manual termination
You can end sessions explicitly by closing the browser programmatically (
browser.close()ordriver.quit()), using the Sessions API, or releasing keep-alive sessions when no longer needed. - Unhandled errors Unhandled errors in your automation code can cause your script to disconnect from the browser, ending the session prematurely. Common scenarios include network interruptions, uncaught exceptions, or exceeded resource limits. To prevent premature termination, make sure to implement proper error handling and cleanup in your code.
CDP connection idle timeout
A Chrome DevTools Protocol (CDP) connection can close after 10 minutes without data moving in either direction on the WebSocket connection. CDP commands sent by your client and CDP events delivered to your client both count as data. If events continue to arrive, the connection can stay open for more than 10 minutes even when your client sends no commands. To keep a quiet connection open, send a lightweight CDP command at least every 5 minutes:keepAlive: true stays available for reconnection until it reaches its session timeout or is released. Without keep alive, the session ends after the disconnect. See long sessions for details.
Session timeout settings
Configure timeouts at two levels: Project level Set the default timeout for all sessions in your project settings. This acts as the fallback when no session-specific timeout is set. Session level Override the project timeout for specific sessions when creating them. This gives you fine-grained control over individual session durations.Debugging completed sessions
The Session Inspector is your primary tool for analyzing completed sessions:Session Replays
Record and replay browser activity to understand what happened
Network Monitor
Inspect HTTP traffic, responses, and timing
Console & Logs
Review JavaScript output and debug messages
Performance
Track CPU, memory usage, and other metrics
Measuring usage
Track and analyze your browser session usage through multiple interfaces: Dashboard Your central hub at browserbase.com/overview shows total browser minutes, active sessions, usage trends, and billing information. Sessions list Browse your session history at browserbase.com/sessions to view duration, status, and resource consumption for individual sessions. For programmatic access to these metrics, see the Measuring Usage Guide.Related guides
Session timeouts
Set time limits for browser sessions.
Measure usage
Inspect usage to understand your browser costs.