Skip to main content

Downloads

Kernel browsers run in fully sandboxed environments with writable filesystems. When your automation downloads a file, it’s saved inside the browser’s filesystem and can be retrieved using Kernel’s File I/O APIs.
Files can only be retrieved while the browser session is still active. Once the browser session is destroyed or times out, all files from that session are permanently deleted and no longer accessible.

Playwright

Playwright performs downloads via the browser itself, so there are a few steps:
  • Create a browser session
  • Configure browser download behavior using CDP
  • Perform the download
  • Retrieve the file from the browser’s filesystem
With behavior: 'default', downloads are saved to the browser’s default download directory. The CDP downloadProgress event includes a filePath field when the download completes, which tells you exactly where the file was saved. Use this path with Kernel’s File I/O APIs to retrieve the file.

Stagehand v3

When using Stagehand with Kernel browsers, you need to configure the download behavior in the localBrowserLaunchOptions:
Here’s a complete example:

Browser Use

Browser Use handles downloads automatically when configured properly.

Uploads

Playwright’s setInputFiles() method allows you to upload files directly to file input elements. You can fetch a file from a URL and pass the buffer directly to setInputFiles().

Considerations

  • The CDP downloadProgress event signals when the browser finishes writing a file, but there may be a brief delay before the file becomes available through Kernel’s File I/O APIs. This is especially true for larger downloads. We recommend polling listFiles to confirm the file exists before attempting to read it.