📚 bonk - Awesome Go Library for Testing

Go Gopher mascot for bonk

Fast, stealth-first browser automation library using Chrome DevTools Protocol over WebSocket with no external dependencies

🏷️ Testing
📂 Selenium and browser control tools
0 stars
View on GitHub 🔗

Detailed Description of bonk

bonk

Go Reference Go Report Card codecov

A fast, stealth-first browser automation library for Go. Direct Chrome DevTools Protocol over WebSocket — no WebDriver, no relay, no detection.

Documentation

Features

  • Direct CDP — WebSocket to Chrome, zero intermediaries, undetectable by default
  • Stealth by default — skips Runtime.enable, patches navigator/plugins/WebGL, strips headless signals
  • Code-generated protocol bindings — full coverage of all 55 CDP domains from upstream .pdl files
  • Context-awarepage.WithContext(ctx) / page.Timeout(d) for deadlines and cancellation
  • Auto-wait elements — polls for visibility before interaction, retries stale references
  • Network interception — intercept, modify, mock, or block requests and responses via the Fetch domain
  • Device emulation — built-in presets for iPhone 15, Pixel 8, iPad Pro, Galaxy S23, and more
  • Session persistence — save and restore cookies and localStorage across runs
  • Isolated contexts — separate cookie jars, proxies, viewports, and locales per context
  • Single dependency — only coder/websocket

Installation

go get github.com/joakimcarlsson/bonk

Quick Start

package main

import (
	"fmt"
	"log"

	"github.com/joakimcarlsson/bonk"
)

func main() {
	b, err := bonk.Launch()
	if err != nil {
		log.Fatal(err)
	}
	defer b.Close()

	ctx, err := b.NewContext()
	if err != nil {
		log.Fatal(err)
	}

	page, err := ctx.NewPage()
	if err != nil {
		log.Fatal(err)
	}

	if err := page.Navigate("https://example.com"); err != nil {
		log.Fatal(err)
	}

	title, _ := page.Title()
	fmt.Println(title)
}

License

See LICENSE file.