Menu

Post image 1
Post image 2
1 / 2
0

Building a Lightweight Web Scraping Toy with Bun’s Experimental `Bun.Webview`

DEV Community·Yue Geng·20 days ago
#915HSECo
Reading 0:00
15s threshold

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 BUN_CHROME_PATH , Bun…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More