Browserbase enables screen view and full-screen screenshots using your desired browser automation framework. For optimal performance, we recommend using CDP (Chrome DevTools Protocol) sessions to capture screenshots, as this method is significantly faster than standard approaches.
First, create a browser session and connect to it using your preferred framework. Then you can take a screenshot using CDP sessions for the best performance:
Using CDP (Chrome DevTools Protocol) for taking screenshots offers several advantages:
For most use cases, we recommend using the CDP approach shown above rather than the standard screenshot methods.
You can work with PDFs in two ways:
page.pdf()
method (shown below)After creating and connecting to a session, here’s how to generate a PDF from a web page using Playwright: