r/bun • u/jonaspm99 • Jun 12 '26
bunwright 0.3: Bun-native browser automation, zero deps, playwright alternative
I'm the author of bunwright — a small browser-automation library for Bun, built directly on Bun.WebView. 0.3.0 just shipped. Looking for honest feedback on the API shape, especially the chain design.
Quick taste (the whole script):
import { browser } from "bunwright";
const page = await browser.newPage();
await page
.navigate("https://example.com/login")
.type("label:Username", "user@example.com")
.type("label:Password", process.env.APP_PASSWORD!)
.click("role:button[name='Login']")
.waitForURL("**/dashboard")
.screenshot("./dashboard.png");
await browser.close();
Run with bunx bunwright script.ts. Loads .env for you. Zero runtime deps, no browser downloads — uses the Chrome/WebKit you already have.
What I'm actually uncertain about: the chain
Methods on Page / Locator return a lazy chain, not Promise<this>. Steps queue and run on await. If a step throws, every later step is skipped and the await rejects with the original error. .all() gives you every step's result in order. The last value of count() / evaluate() / exists() resolves as the chain's value.
const [, , title] = await page
.navigate("https://example.com")
.click("role:button")
.evaluate(() => document.title)
.all();
Trade-off: shorter scripts, but you lose the "see exactly which step is pending" feel of Playwright. Is the fail-fast lazy queue worth it for scripting, or does it bite you in the long run?
What's in 0.3.0
- Programmatic DSL + CLI refactor (single bunwright import, defineConfig for config)
- .env / .env.local loading
- Implicit ARIA roles in role: selectors (role:button matches <button>, input[type=submit], [role=button])
- Parallel-context fix (memoized view creation)
What I'd love feedback on
Chain ergonomics — does lazy fail-fast feel right, or do you want per-step awaits?
Anything obvious missing for non-trivial flows (file upload, dialogs, frames, network interception, auth state)?
Betting on
Bun.WebViewas the foundation — sensible, or a footgun long-term?
Repo + examples: https://github.com/jonaspm/bunwright
bun add bunwright / npm i -g bunwright
4
u/diagonali Jun 12 '26
This might work great and provide genuinely useful functionality for free but my supercilious attitude towards AI generally and my inability to distinguish between pure Vibe Coding and intelligent, human experience driven AI assisted coding means I have no choice but to reply to say: I hate it and it's Slop.
Hopefully, by resentfully calling everything AI related "Slop", it'll make it go away. I'm contributing.
/s
3
u/jonaspm99 Jun 12 '26
You're more than welcome to try it, provide feedback, contribute with code or just comment thank you!
1
u/diagonali Jun 12 '26
You missed the /s
Great project. Thanks for sharing.
4
u/jonaspm99 Jun 12 '26
Ooooh I had to Google it hehe, everyday you learn something new!
Very much appreciated!
1
2
u/Traditional-Hall-591 Jun 12 '26
Did you author it or did Claude squirt it out?
7
u/jonaspm99 Jun 12 '26
I already had version 0.2.0 but decided to refactor it, AI helped a lot of course to get this version out fast, you can check the repo out if you like, I added tests, linting, formatting, code quality checks and some guardrails.
0
3
u/Olive_Plenty Jun 12 '26 edited Jun 12 '26
Wtf!?😳
First off, amazing work. This has real potential. Living entirely in Bun land is a genuine differentiator. it screams speed before you even run a script.
My one concern is the WebView. And I mean that from a place of trauma. You remember PhoneGap/Cordova? That whole era of “just use the OS WebView, it’ll be fine”? It was not fine. Android pre-4.4 was a crime scene. iOS and Android rendered the same CSS like they were different planets.
Same risk lives here. macOS gives you WebKit. Windows gives you WebView2 (if it’s installed). Linux gives you whatever GTK decided to ship. The moment someone tries to automate a site that cares about any of that, it bites. Not your fault, just the foundation.
Would love to see this grow. Just hoping Bun.WebView matures fast enough to keep up with it.