Bun Ships a Zero-Dependency WebView That Screenshots in 3 Lines
Browser automation has been a heavyweight dependency for years. A built-in, zero-install WebView inside the runtime shrinks the cost of screenshot generation, scraping, and integration testing to a few lines of script — no driver, no separate browser binary, no system packages.
Bun.WebView eliminates the 300 MB Chromium download and system-library dance that comes with Puppeteer. On macOS it uses the built-in WKWebView; on Linux and Windows it auto-discovers an existing Chrome, Edge, or Chromium installation. A screenshot takes three lines of code, and the API returns a raw Buffer that can be written to disk or piped anywhere.
Beyond screenshots, the API dispatches genuine OS-level keyboard and mouse events — `isTrusted` is always true — so anti-bot detection sees real interaction. `evaluate` runs arbitrary JavaScript in the page context and returns JSON-serializable values, with Promises automatically awaited. Multiple views share a single browser subprocess, making crawls faster than launching a fresh browser each time.
Persistence is a one-liner via `dataStore`, which saves cookies and localStorage to a directory. Console output from the page is captured through a callback, and raw Chrome DevTools Protocol commands are available for network interception, performance tracing, or cookie manipulation. The feature is experimental and requires Bun ≥ 1.3.12; temporary directories are cleaned up automatically when `await using` is used.
Bun is absorbing use cases that previously required a separate automation library, turning the runtime itself into a browser driver.
Using the OS-native WebView on macOS sidesteps the entire Chromium dependency chain, which is the single largest source of friction in headless browsing.
Dispatching OS-level events rather than synthetic DOM events closes a long-standing gap between scripted automation and what websites actually see, making bot detection far harder.
The shared subprocess model — one browser, many views — is a practical performance win that Playwright and Puppeteer could adopt more aggressively.
Exposing CDP directly alongside a high-level API gives developers an escape hatch without pulling in another library, which keeps the dependency tree small.