Taking screenshots

Browserbase enables screen view and full-screen screenshots using your desired browser automation framework with the following configuration:

Screenshot typeDPIFormat
Screen view (default)80jpeg
Full-screen90jpeg

Save a screenshot locally

A screenshot taken with Browserbase can be saved locally as a file:

Downloading files

A typical use case for headless browsers is downloading files from web pages. Our browsers are configured to sync any file you download to our storage infrastructure. We add a Unix timestamp onto the end of the file name to avoid naming conflicts when downloading multiple files (e.g., sample.pdf will become sample-1719265797164.pdf).

Follow these steps to download files:

  1. Use the Sessions API to create a new session. You’ll need the session ID for when you connect.

  2. Finally, configure your library’s downloads location:

We sync the files in real-time; the size of your downloads might affect their immediate availability through the /downloads endpoint. The above code provides a snippet to handle that use case.

Session downloads API

Learn more about the available params and response fields

Uploading files

You can easily upload files to websites using Playwright, Puppeteer, or Selenium.

For Playwright, you can upload files directly from your local path.

  1. You’ll need your file to be available where you’re running your Playwright code.

  2. In this example, we’re using an image logo.png that’s available locally.

  3. Use the setInputFiles to specify the path.

For Puppeteer and Selenium, you’ll need to upload your files to our browser instance using our Upload API.

  1. Use the Sessions API to create a new session. You’ll need the session ID when you upload it.

  2. Use the Session Upload API to upload a file.

  3. Connect to the browser and the file will be available in the /tmp/.uploads directory.