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
Playwright
Large file uploads
For larger files, use the Session Uploads API:- Node.js
- Python
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