Playwright Go
活跃简介
Playwright Go 是 Playwright 浏览器自动化库的 Go 绑定,为 Agent 提供多浏览器支持。
核心特性
- 多浏览器 — Chromium、Firefox、WebKit
- 自动等待 — 智能等元素可见与稳定
- Playwright API — 与 Node/JS 版本完全对齐
- 可观测 — Trace Viewer 与视频回放
- 并行执行 — 内置并发测试支持
- TypeScript-test — 支持 TS 测试用例跨语言复用
适用场景
💡 在 Go 服务/Agent 中驱动浏览器自动化
💡 把 Node Playwright 测试迁移到 Go
💡 为 e2e 测试建立视频与 trace 回放
💡 用 WebKit 测试跨浏览器兼容
快速开始
# 在 Go 中启动 Playwright
go get github.com/playwright-community/playwright-go
pw, _ := playwright.Run()
browser, _ := pw.Chromium.Launch()
page, _ := browser.NewPage()
page.Goto("https://example.com")