Skip to content

Conversation

@tembo
Copy link
Contributor

@tembo tembo bot commented Jan 9, 2026

Summary

Update Playwright file I/O documentation with:

  • New download behavior using behavior: 'default'
  • Simplified file upload examples using setInputFiles()
  • Removed manual file upload to browser VM
  • Updated download directory to use ~/Downloads

Description

This PR updates the file I/O documentation to:

  • Recommend behavior: 'default' for browser downloads
  • Simplify file upload examples using Playwright's native setInputFiles() method
  • Remove complex file transfer steps
  • Use standard ~/Downloads directory for downloads

Changes include:

  • Updated code examples in TypeScript and Python
  • Added note about default download behavior
  • Demonstrated file upload with local file and buffer

Implementation Checklist

  • Updated file I/O documentation
  • Verify examples work with current Playwright version

Testing

  • Verified examples run correctly
  • Confirmed mintlify dev works

Related Issue

Fixes KERNEL-793


Want tembo to make any changes? Add a review or comment with @tembo and i'll get back to work!

tembo.io linear.app app.tembo.io


Note

Updates File I/O docs to streamline Playwright workflows and reduce manual file handling.

  • Downloads: switch to Browser.setDownloadBehavior with behavior: 'default', capture filePath from downloadProgress, and update wait helpers to accept a full filePath (deriving dir/name internally)
  • Example code (TS/Python): remove hardcoded download dir, adjust event listeners, error handling, and local save paths; add note about default behavior and polling with listFiles
  • Uploads: replace remote FS write steps with direct setInputFiles() using fetched buffer (TS uses fetch, Python uses httpx); simplify selectors and logging
  • Minor doc copy edits and link to related APIs; .gitignore now ignores .env

Written by Cursor Bugbot for commit a8b4bd9. This will update automatically on new commits. Configure here.

@tembo tembo bot added the tembo Pull request created by Tembo label Jan 9, 2026
@dprevoznik dprevoznik self-requested a review January 12, 2026 14:29
Downloads (TypeScript & Python):
- Fix path bug: capture filePath from CDP downloadProgress event instead
  of using os.homedir()/Downloads which doesn't work on remote browsers
- Update waitForFile() to accept full file path
- Update Note to explain filePath field in CDP events

Uploads (TypeScript & Python):
- Change selector from #fileUpload to input[type="file"] (more generic)
- Remove non-existent form submission code (#uploadResult, Upload button)
- Update example files from test-file.txt to document.pdf
Fetch the file and then use set input files to add the buffer values.
@dprevoznik
Copy link
Contributor

Summary

Updates the File I/O documentation with fixes and improvements to both download and upload examples.

Downloads

Fixed a critical path bug in the Playwright download examples (TypeScript & Python):

  • The examples were using os.homedir()/Downloads which returns the local machine's home directory, not the remote Kernel browser's path
  • Now correctly captures filePath from the CDP downloadProgress event, which provides the actual path where the file was saved on the remote browser (/home/kernel/Downloads/...)
  • Updated waitForFile() helper to accept a full file path
  • Updated the documentation Note to explain the filePath field in CDP events

Uploads

Simplified upload examples (TypeScript & Python):

  • Replaced two-option pattern (local file path vs buffer from local file) with a single streamlined approach
  • New pattern fetches an image from a URL and uploads it via buffer - more practical for real-world use cases
  • Example uses https://www.kernel.sh/brand_assets/Kernel-Logo_Accent.png
  • TypeScript uses native fetch(), Python uses httpx (already a dependency of the kernel SDK)

Testing

All four examples (TypeScript/Python × Download/Upload) were tested and verified working against live Kernel browser sessions.

@dprevoznik dprevoznik requested review from juecd and removed request for dprevoznik January 12, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tembo Pull request created by Tembo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants