Playwright
Direct upload
With Playwright, upload files directly from your local path. After creating and connecting to a session, follow these steps:- Make sure your file is available where you’re running your Playwright code
- Use the
setInputFilesmethod to upload the file - The file path should be relative to your current working directory
- Node.js
- Python
Node.js Playwright
Large file uploads
For larger files, use the Session Uploads API:- Node.js
- Python
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:- Detect file input clicks using Playwright’s
page.on('filechooser')event - Show your own file picker (e.g., a native OS picker or web UI) to select a local file
- Upload the file via the Session Uploads API
- Attach the file to the input element using CDP’s
DOM.setFileInputFiles
Session uploads API
Learn more about the available params and response fields
Download files
Retrieve files from browser sessions.