Introduction
Starting from Bun v1.3.12, a new experimental API called Bun.Webview was introduced. It enables simple browser automation and can partially replace tools like Playwright . Pretty exciting, so I gave it a try.
For macOS users, Bun.Webview can directly use the system’s native WebKit as the backend. On Windows and Linux, Chrome can be used as the backend via:
const view = new Bun . WebView ({ backend : " chrome " });
Enter fullscreen mode
Exit fullscreen mode
According to the Bun documentation , Bun searches for Chrome in the following order:
The path provided in backend: { type: "chrome", path: "..." }
The BUN_CHROME_PATH environment variable
$PATH (google-chrome-stable, google-chrome, chromium-browser, chromium, brave-browser, microsoft-edge, chrome)
Common installation directories
Playwright cache ( ~/Library/Caches/ms-playwright or ~/.cache/ms-playwright ) for chrome-headless-shell
Integrating the Chrome Backend
In practice, I found that on Windows, no matter how I set…