Skip to main content
Browserbase supports viewport and full-page screenshots with any browser automation framework. For best performance, use CDP (Chrome DevTools Protocol) to capture screenshots; it’s significantly faster than standard approaches.

Take a screenshot

First, create a browser session and connect to it. Then take a screenshot using CDP for best performance:
For a viewport-only screenshot (just what’s visible on screen) with CDP, remove captureBeyondViewport or set it to false.

CDP screenshot reference

Just the CDP screenshot code:

Why use CDP for screenshots?

CDP (Chrome DevTools Protocol) offers several advantages for screenshots:
  1. Performance: CDP screenshots are significantly faster than traditional methods
  2. Memory efficiency: Uses less memory as it directly communicates with the browser’s debugging protocol
  3. Quality control: Provides more control over image quality and format settings
  4. Reliability: More stable for full-page screenshots of complex web applications
For most use cases, the CDP approach shown above outperforms standard screenshot methods.