mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 19:38:58 +00:00
Add comprehensive browser automation API using Chrome DevTools Protocol: Core Features: - Bun.browser() function to launch Chrome/Chromium instances - Browser class with CDP connection management - Page class for tab control and interaction - Input interfaces: Keyboard, Mouse, Touchscreen - Element and JSHandle classes for DOM manipulation API Implementation: - Browser.launch() with configurable options (headless, args, etc.) - Page navigation: goto(), goBack(), goForward(), reload() - Content manipulation: content(), setContent(), title() - JavaScript evaluation: evaluate(), evaluateHandle() - Element interaction: querySelector(), click(), type() - Screenshots: screenshot() with various formats - Viewport control: setViewport(), emulate() - Cookie management: setCookie(), cookies(), deleteCookie() - Event handling: on(), off(), once() - Network control: setUserAgent(), setExtraHTTPHeaders() Browser Automation: - Automatic Chrome process spawning with proper flags - WebSocket connection to Chrome DevTools Protocol - Support for headless and headful modes - Proper cleanup and resource management - Error handling for common failure scenarios Testing: - Basic API exposure tests - Integration tests with real browser instances - DOM interaction and JavaScript evaluation tests - Screenshot and viewport manipulation tests - Multi-page handling tests This replaces Puppeteer with a native Bun implementation for browser automation tasks including web scraping, testing, and automated browser interactions. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>