Repolode
mxschmitt

mxschmitt/playwright-go

Go library for browser automation that drives Chromium, Firefox and WebKit through one Playwright API.

Open-source alternative to:Selenium

Stars
3,539
Forks
250
Open issues
5
Last commit
2 days ago

What is it?

playwright-go brings the Playwright browser automation API to Go. It lets a Go program launch Chromium, Firefox and WebKit, navigate pages, interact with elements and read results, using the same API across all three browser engines on Linux, macOS and Windows, in both headless and headed mode.

The library runs a Playwright driver in the background and communicates with it over stdio, so the browser logic is the same as in the official Node.js implementation. Installing the driver and browsers is done through a `playwright install` command or a call to `playwright.Install()` from code. Each minor version of the library pairs with a specific driver version.

The API covers locators that target elements by role, label, text or test ID, auto-waiting actions, isolated browser contexts with saved authentication state, trace recording, network routing and mocking, device and geolocation emulation, file downloads and uploads, PDF rendering and video recording.

Key features

  • 01Single API for Chromium, Firefox and WebKit on Linux, macOS and Windows.
  • 02Role-, label- and text-based locators that avoid brittle CSS paths.
  • 03Auto-waiting actions and web-first assertions that retry until conditions are met.
  • 04Isolated browser contexts with reusable saved authentication state.
  • 05Trace recording and network request routing or mocking.
  • 06Device, geolocation, locale and timezone emulation.

Use cases

  • End-to-end testing of web applications written in Go.
  • Scraping dynamic pages that need JavaScript rendering.
  • Generating PDFs or screenshots of web pages from a Go service.
  • Automating repetitive browser workflows inside Go tools.

Quick start

  1. 1

    Add the Go library to your module

    go get -u github.com/mxschmitt/playwright-go
  2. 2

    Install the Playwright driver and browsers (with OS dependencies)

    go run github.com/mxschmitt/playwright-go/cmd/playwright@v0.xxxx.x install --with-deps

Things to know

  • Each minor version upgrade requires a matching Playwright driver version, so the install version must match your go.mod.
  • The OS browser dependencies must be installed manually if you use playwright.Install() without privileges.

In collections

Topics

FAQ

What is playwright-go?
Go library for browser automation that drives Chromium, Firefox and WebKit through one Playwright API. playwright-go brings the Playwright browser automation API to Go. It lets a Go program launch Chromium, Firefox and WebKit, navigate pages, interact with elements and read results, using the same API across all three browser engines on Linux, macOS and Windows, in both headless and headed mode.
Is playwright-go free to use? What license does it have?
playwright-go is open source under the MIT license. Check the license terms before using it in commercial products.
Is playwright-go still maintained?
Actively maintained. The last commit to playwright-go was on Nov 5, 2026.
What can I use playwright-go for?
End-to-end testing of web applications written in Go. Scraping dynamic pages that need JavaScript rendering. Generating PDFs or screenshots of web pages from a Go service. Automating repetitive browser workflows inside Go tools.
How do I install playwright-go?
Add the Go library to your module: go get -u github.com/mxschmitt/playwright-go Install the Playwright driver and browsers (with OS dependencies): go run github.com/mxschmitt/playwright-go/cmd/playwright@v0.xxxx.x install --with-deps
Where can I get playwright-go?
The source code and installation instructions are on GitHub: https://github.com/mxschmitt/playwright-go

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects