All Projects → mxschmitt → Playwright Go

mxschmitt / Playwright Go

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

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Playwright Go

Playwright Sharp
.NET version of the Playwright testing and automation library.
Stars: ✭ 459 (+68.75%)
Mutual labels:  automation, firefox, chromium, webkit
Ferrum
Headless Chrome Ruby API
Stars: ✭ 1,009 (+270.96%)
Mutual labels:  automation, chromium, headless, headless-chrome
Chrome Devtools Protocol
Chrome Devtools Protocol client for PHP
Stars: ✭ 112 (-58.82%)
Mutual labels:  automation, headless, headless-chrome
Phantomas
Headless Chromium-based web performance metrics collector and monitoring tool
Stars: ✭ 2,191 (+705.51%)
Mutual labels:  automation, chromium, headless-chrome
Pychromeless
Python Lambda Chrome Automation (naming pending)
Stars: ✭ 219 (-19.49%)
Mutual labels:  automation, selenium, chromium
Edge Selenium Tools
An updated EdgeDriver implementation for Selenium 3 with newly-added support for Microsoft Edge (Chromium).
Stars: ✭ 41 (-84.93%)
Mutual labels:  automation, selenium, chromium
Spam Bot 3000
Social media research and promotion, semi-autonomous CLI bot
Stars: ✭ 79 (-70.96%)
Mutual labels:  automation, selenium, firefox
Nvidia Sniper
🎯 Autonomously buy Nvidia Founders Edition GPUs as soon as they become available.
Stars: ✭ 193 (-29.04%)
Mutual labels:  automation, selenium, firefox
Sponsorblock
Skip YouTube video sponsors (browser extension)
Stars: ✭ 3,627 (+1233.46%)
Mutual labels:  hacktoberfest, firefox, chromium
headless-chrome-alpine
A Docker container running headless Chrome
Stars: ✭ 26 (-90.44%)
Mutual labels:  headless, chromium, headless-chrome
Taiko
A node.js library for testing modern web applications
Stars: ✭ 2,964 (+989.71%)
Mutual labels:  automation, headless, headless-chrome
mitm-play
Man in the middle using Playwright
Stars: ✭ 13 (-95.22%)
Mutual labels:  firefox, chromium, webkit
Navalia
A bullet-proof, fast, and reliable headless browser API
Stars: ✭ 950 (+249.26%)
Mutual labels:  automation, headless, headless-chrome
Aet
AET - a system that detects visual changes on web sites and performs basic page health checks
Stars: ✭ 100 (-63.24%)
Mutual labels:  automation, hacktoberfest, selenium
Pywhatsapp
Python Automation using selenium & Scheduling of messages and media
Stars: ✭ 257 (-5.51%)
Mutual labels:  automation, hacktoberfest, selenium
Python Scripts
Collection of Various Python Script's.💻
Stars: ✭ 195 (-28.31%)
Mutual labels:  automation, hacktoberfest, selenium
Chromeless
🖥 Chrome automation made simple. Runs locally or headless on AWS Lambda.
Stars: ✭ 13,254 (+4772.79%)
Mutual labels:  selenium, headless, headless-chrome
Mue
Fast, open and free-to-use new tab page for modern browsers
Stars: ✭ 56 (-79.41%)
Mutual labels:  hacktoberfest, firefox, chromium
Cdp4j
cdp4j - Chrome DevTools Protocol for Java
Stars: ✭ 232 (-14.71%)
Mutual labels:  automation, selenium, chromium
throughout
🎪 End-to-end testing made simple (using Jest and Puppeteer)
Stars: ✭ 16 (-94.12%)
Mutual labels:  selenium, chromium, headless-chrome

🎭 Playwright for

PkgGoDev License Go Report Card Build Status Join Slack Coverage Status Chromium version Firefox version WebKit version

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 90.0.4430.0
WebKit 14.2
Firefox 86.0b10

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

Installation

go get github.com/mxschmitt/playwright-go

Capabilities

Playwright is built to automate the broad and growing set of web browser capabilities used by Single Page Apps and Progressive Web Apps.

  • Scenarios that span multiple page, domains and iframes
  • Auto-wait for elements to be ready before executing actions (like click, fill)
  • Intercept network activity for stubbing and mocking network requests
  • Emulate mobile devices, geolocation, permissions
  • Support for web components via shadow-piercing selectors
  • Native input events for mouse and keyboard
  • Upload and download files

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.QuerySelectorAll(".athing")
	if err != nil {
		log.Fatalf("could not get entries: %v", err)
	}
	for i, entry := range entries {
		titleElement, err := entry.QuerySelector("td.title > a")
		if err != nil {
			log.Fatalf("could not get title element: %v", err)
		}
		title, err := titleElement.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)
	}
}

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.

Is Playwright for Go ready?

We are ready for your feedback, but we are still covering Playwright Go with the tests.

Resources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].