Playwright
Direct Upload
For Playwright, you can 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
Playwright
Large Files Upload
For larger files, you can use the Session Uploads API. Follow this example:- Node.js
- Python
Manual Upload through Live View
When using the Live View to interact with a browser session, clicking a file input triggers the browser’s native file picker. However, since the browser runs remotely on Browserbase infrastructure, it cannot access files on your local machine. To enable manual uploads through the live view, one workaround you can implement is to intercept file chooser events and handle uploads 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