Lightweight native Go implementation of the W3C WebDriver protocol for modern browser automation.
go-native-selenium provides a clean and dependency-light alternative
to traditional Selenium bindings by implementing the WebDriver
protocol directly in Go.
It is designed for:
- End‑to‑End testing
- Browser automation
- CI/CD pipelines
- Web scraping
- QA regression testing
- Pure Go HTTP implementation of the W3C WebDriver protocol
- No Selenium Java server dependency
- Lightweight and fast
Supports common WebDriver strategies:
ByIDByCSSSelectorByName(Python-style translation)
Example:
email, _ := client.FindElement(webdriver.ByName, "email")Automatically translated to:
[name="email"]Modern frontends like React, Vue and SPA frameworks require reliable synchronization.
The library includes:
- Explicit waits
- Polling based conditions
- Timeout control
- Elimination of
time.Sleep()anti‑patterns
Example:
wait := client.NewWait(10 * time.Second)
email, err := wait.Until(
client.UntilElementLocated(
webdriver.ByCSSSelector,
"input[type='text']",
),
)Supports cookie manipulation for faster automation flows.
Capabilities:
- Capture browser cookies
- Inject cookies into sessions
- Skip login screens
Ideal for:
- QA automation
- Authenticated scraping
- CI test pipelines
Built‑in screenshot support.
client.Screenshot("evidence.png")Features:
- WebDriver Base64 screenshot capture
- Automatic PNG conversion
- Ideal for CI failure logs
go-native-selenium/
│
├── cmd/
│ └── demo.go
├── driver/
│ ├── chrome.go
│ ├── downloader.go
│ ├── fetcher.go
│ └── manager.go
│
├── webdriver/
├── cookies.go
├── elements.go
├── javascript.go
├── navigation.go
├── options.go
├── screenshot.go
├── session.go
├── timeouts.go
├── wait.go
└── window.go
Automatically detects the installed Chrome version and ensures a compatible ChromeDriver is used.
Example:
chromeVersion, err := driver.GetChromeVersion()
if err != nil {
panic(err)
}
driverPath, err := driver.DownloadDriver(chromeVersion)
if err != nil {
panic(err)
}
service, err := driver.StartService(driverPath)
if err != nil {
panic(err)
}
defer service.Stop()caps := webdriver.DefaultCapabilities()
caps.AddArgument("--headless=new")
caps.AddArgument("--disable-gpu")
client, err := webdriver.NewSession(service.URL, caps)
if err != nil {
panic(err)
}
defer client.Quit()Headless mode is recommended for CI/CD environments.
client.Navigate("https://example.com/login")
wait := client.NewWait(10 * time.Second)
email, err := wait.Until(
client.UntilElementLocated(
webdriver.ByCSSSelector,
"input[type='text']",
),
)
if err != nil {
panic(err)
}
email.SendKeys("champiao@example.com")
client.Screenshot("evidence.png")el, err := client.FindElement(...)
if err != nil {
return err
}
el.SendKeys("value")- End‑to‑End testing
- CI automation
- Browser workflows
- Scraping authenticated systems
- Regression testing
Current implementation targets:
- Linux environments
- Chrome based browsers
Future improvements may include:
- macOS support
- Windows support
- Firefox WebDriver support
- Remote WebDriver endpoints
Planned improvements:
- Parallel session support
- Structured logging
- Network interception
- HAR capture
- Performance metrics
- Playwright‑like debugging tools
This project is licensed under the MIT License.
You are free to:
- Use
- Modify
- Distribute
- Use commercially
As long as the original license is included.
Contributions are welcome.
Typical workflow:
- Fork the repository
- Create a feature branch
- Commit changes
- Submit a pull request
go-native-selenium focuses on:
- simplicity
- reliability
- Go idiomatic design
- minimal dependencies
The goal is to provide a clean and modern WebDriver experience for Go developers.