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
Playwright

Large file uploads

For larger files, use the Session Uploads API:

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