playwright-go is a free, open source data extraction & web scraping project written in Go and released under MIT. It has 3,510 GitHub stars, 246 forks and 4 open issues, and was last pushed 10 days ago. On this registry it ranks #50 of 117 tracked projects in Data Extraction & Web Scraping, with 5 head-to-head comparisons available.

What is playwright-go?

Playwright for Go is a browser automation library, distributed as the Go module github.com/mxschmitt/playwright-go under the MIT licence, that drives Chromium, Firefox and WebKit through a single API and is aimed at Go developers who need programmatic control of real browsers.

What it is

Playwright for Go is the Go binding of Playwright, a cross-browser automation toolkit. It exposes one API surface for three browser engines — the README pins Chromium 151.0.7922.34, Firefox 153.0 and WebKit 26.5 — and runs each of them in both headless and headed mode on Linux, macOS and Windows. The library is written in Go, is published as github.com/mxschmitt/playwright-go, carries the MIT licence, and ships with an API reference on pkg.go.dev, a set of example recipes in the repository's examples directory, and documentation hosted at playwright.dev.

The concrete problem it solves is automating browsers without leaving the Go ecosystem. It replaces hand-rolled, engine-specific driver plumbing — and, for teams already using Selenium, the task of assembling per-browser drivers and reconciling their differences — with a single package in which the same call sequence works against Chromium, Firefox or WebKit. In the registry it sits in Data & Analytics / Data Extraction & Web Scraping, and its own headline example is a scraper: a program that opens Hacker News, calls page.Locator(".athing").All(), and reads the current top-voted items. The same primitives support scripted browser workflows generally, not only scraping.

Key capabilities

  • One API across three engines: Chromium 151.0.7922.34, Firefox 153.0 and WebKit 26.5, with headless and headed execution supported for all browsers on all platforms.
  • A dedicated installer command: go run github.com/mxschmitt/playwright-go/cmd/[email protected] install, with a --with-deps flag that also installs the operating-system dependencies.
  • Programmatic installation from application code through playwright.Install(), for cases where the driver and browsers are fetched at runtime rather than from a shell.
  • Version coupling managed through go.mod: each minor version of the library requires a specific Playwright driver version, and the install command's version placeholder is meant to be replaced with the version already in use.
  • Locator-based element access, shown in the README with page.Locator(".athing").All() alongside playwright.Run(), pw.Chromium.Launch(), browser.NewPage() and page.Goto().
  • Cross-language documentation: the guides, concepts and API semantics on playwright.dev are shared across all Playwright languages, with only the code samples written in JavaScript.
  • Repository topics covering automation, browser-automation, chromium, firefox, go, golang, headless, headless-chrome, playwright, selenium and webkit.

Who uses it and how

  • Go teams building scrapers and crawlers against JavaScript-rendered pages, following the README's Hacker News example as a starting pattern.
  • Projects that test or exercise a web application across all three engines on Linux, macOS and Windows rather than validating against a single browser.
  • Services and CI jobs that provision browsers headlessly, using the install command's --with-deps flag where privileged installation of OS-level dependencies is possible.
  • Applications that prefer to fetch the driver and browsers from Go code via playwright.Install(), typically where running a separate install step is inconvenient.
  • Long-lived Go codebases that pin the library in go.mod and accept that a minor-version upgrade obliges them to move the driver version in step.

Getting started

Add the module with go get -u github.com/mxschmitt/playwright-go, then install the Playwright driver and browsers by running go run github.com/mxschmitt/playwright-go/cmd/[email protected] install --with-deps, replacing the version placeholder with the version recorded in your go.mod.

How it compares

Among the similar tools named in its own topic list, Selenium is the closest point of reference: both automate Chromium, Firefox and WebKit, but Playwright for Go presents a single library-managed driver install rather than a separate driver per engine, and its documentation is shared with the other Playwright language bindings. Developers who need a language other than Go would use one of those other bindings instead, since the concepts and API semantics are described as identical across them. No list of paid products it replaces is given here, so no licence or cost comparison beyond its MIT licence can be drawn.

When to use it — and when not to

A self-hoster takes on real operational work: the Playwright driver and three browser builds have to be installed on each machine, operating-system dependencies may require elevated privileges when --with-deps cannot be used, and the library's minor versions are locked to specific driver versions. Teams not writing Go should choose a different Playwright binding, and anyone wanting a fully managed, hosted browser service will not find one here. The README is functional but compact — it defers concepts and semantics to playwright.dev, so the repository itself is a thin reference rather than a complete guide.

project readme (upstream, from github) — read inline

🎭 Playwright for Go

PkgGoDev License Go Tests Coverage Status Join DiscordChromium version Firefox version WebKit version

Website | API reference | Example recipes

Playwright is a Go library to automate Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.

Linux macOS Windows
Chromium 151.0.7922.34 :white_check_mark: :white_check_mark: :white_check_mark:
WebKit 26.5 :white_check_mark: :white_check_mark: :white_check_mark:
Firefox 153.0 :white_check_mark: :white_check_mark: :white_check_mark:

Headless and headed execution is supported for all the browsers on all platforms.

Installation

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

Install the Playwright driver and browsers (add --with-deps to also install the OS dependencies). Note that you should replace the version number 0.xxxx.x with the version used in your current go.mod. Each minor version upgrade requires a specific Playwright driver version.

go run github.com/mxschmitt/playwright-go/cmd/[email protected] install --with-deps
# Or
go install github.com/mxschmitt/playwright-go/cmd/[email protected]
playwright install --with-deps

Alternatively, you can download the driver and browsers from your code. If your operating system lacks the browser dependencies you still need to install them manually, because installing system dependencies requires privileges.

err := playwright.Install()

Documentation

https://playwright.dev/docs/intro

The guides, concepts and API semantics are shared across all Playwright languages — only the code samples on that site are written in JavaScript.

API Reference

https://pkg.go.dev/github.com/mxschmitt/playwright-go

Example

The following example crawls the current top voted items from Hacker News.

package main

import (
	"fmt"
	"log"

	"github.com/mxschmitt/playwright-go"
)

func main() {
	pw, err := playwright.Run()
	if err != nil {
		log.Fatalf("could not start playwright: %v", err)
	}
	browser, err := pw.Chromium.Launch()
	if err != nil {
		log.Fatalf("could not launch browser: %v", err)
	}
	page, err := browser.NewPage()
	if err != nil {
		log.Fatalf("could not create page: %v", err)
	}
	if _, err = page.Goto("https://news.ycombinator.com"); err != nil {
		log.Fatalf("could not goto: %v", err)
	}
	entries, err := page.Locator(".athing").All()
	if err != nil {
		log.Fatalf("could not get entries: %v", err)
	}
	for i, entry := range entries {
		title, err := entry.Locator("td.title > span > a").TextContent()
		if err != nil {
			log.Fatalf("could not get text content: %v", err)
		}
		fmt.Printf("%d: %s\n", i+1, title)
	}
	if err = browser.Close(); err != nil {
		log.Fatalf("could not close browser: %v", err)
	}
	if err = pw.Stop(); err != nil {
		log.Fatalf("could not stop Playwright: %v", err)
	}
}

Capabilities

  • Resilient locators — find elements the way a user sees the page with GetByRole, GetByLabel, GetByPlaceholder, GetByText and GetByTestId instead of brittle CSS paths.
  • Auto-wait — actions such as Click and Fill wait for the element to be actionable, and web-first assertions created via playwright.NewPlaywrightAssertions() retry until the condition is met. No arbitrary sleeps.
  • Full isolation — every BrowserContext is the equivalent of a brand new browser profile at near-zero overhead. Save the authentication state once with context.StorageState() and reuse it everywhere.
  • Trace Viewer — record a trace via context.Tracing() and inspect DOM snapshots, network traffic and console logs afterwards with playwright show-trace.
  • Network interception — stub and mock requests with page.Route(), or monitor all traffic of a page.
  • Emulation — mobile devices, geolocation, permissions, color scheme, locale and timezone.
  • Beyond the DOM — scenarios that span multiple pages, domains and iframes, shadow-piercing selectors, native mouse and keyboard input, file uploads and downloads.

Docker

Refer to the Dockerfile.example to build your own Docker image.

More examples

How does it work?

Playwright is a Node.js library which uses:

  • Chrome DevTools Protocol to communicate with Chromium
  • Patched Firefox to communicate with Firefox
  • Patched WebKit to communicate with WebKit

These patches are based on the original sources of the browsers and don't modify the browser behaviour, so the browsers are basically the same (see here) as you see them in the wild. The support for different programming languages is based on exposing a RPC server in the Node.js land which can be used to allow other languages to use Playwright without implementing all the custom logic.

The bridge between Node.js and the other languages is basically a Node.js runtime combined with Playwright which gets shipped for each of these languages (around 50MB) and then communicates over stdio to send the relevant commands. This will also download the pre-compiled browsers.

Other languages

More comfortable in another programming language? Playwright is also available in

Frequently asked questions

Is playwright-go free to use?

playwright-go is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does playwright-go do?

Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.

What is playwright-go written in?

playwright-go is primarily written in Go. Its source is publicly available at https://github.com/mxschmitt/playwright-go, and it has 3,510 GitHub stars.