Skip to main content
Upload files to websites using Playwright, Puppeteer, or Selenium. The approach varies by framework:

Playwright

Direct upload

With Playwright, upload files directly from your local path. After creating and connecting to a session, follow these steps:
  1. Make sure your file is available where you’re running your Playwright code
  2. Use the setInputFiles method to upload the file
  3. The file path should be relative to your current working directory
Node.js Playwright

Large file uploads

For larger files, use the Session Uploads API:

Upload limits

The Session Uploads API has these limits:
  • Each file can be up to 100 MB.
  • A file name can be up to 255 bytes in UTF-8: 255 ASCII characters, or fewer in scripts such as Chinese or Japanese. A longer or empty name gets a 400.
  • The files you upload to one session can total up to 15 GB. Uploading a file again counts again. Past 15 GB, the API returns 413. Start a new session to upload more.
  • The API limits how many files you can upload to each session per minute. Past the limit, it returns 429.

Manual upload through Live View

When using Live View, clicking a file input triggers the browser’s native file picker. Since the browser runs remotely on Browserbase infrastructure, it can’t access files on your local machine. To handle manual uploads through Live View, intercept file chooser events and upload programmatically:
  1. Detect file input clicks using Playwright’s page.on('filechooser') event
  2. Show your own file picker (e.g., a native OS picker or web UI) to select a local file
  3. Upload the file via the Session Uploads API
  4. Attach the file to the input element using CDP’s DOM.setFileInputFiles
See the following example script for a complete implementation.

Session uploads API

Learn more about the available params and response fields

Download files

Retrieve files from browser sessions.