All Projects → skatiyar → Cri

skatiyar / Cri

Licence: unlicense
Type safe go bindings to interact with chrome remote interface.

Programming Languages

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

Projects that are alternatives of or similar to Cri

Puppeteer Sharp Extra
Plugin framework for PuppeteerSharp
Stars: ✭ 39 (-67.23%)
Mutual labels:  headless-chrome
Vivliostyle Cli
⚒ Supercharge command-line publication workflow.
Stars: ✭ 57 (-52.1%)
Mutual labels:  headless-chrome
Api Store
Contains all the public APIs listed in Phantombuster's API store. Pull requests welcome!
Stars: ✭ 69 (-42.02%)
Mutual labels:  headless-chrome
Chrome Pool
Headless chrome tabs manage pool
Stars: ✭ 40 (-66.39%)
Mutual labels:  headless-chrome
Puppeteer Deep
Puppeteer, Headless Chrome;爬取《es6标准入门》、自动推文到掘金、站点性能分析;高级爬虫、自动化UI测试、性能分析;
Stars: ✭ 1,033 (+768.07%)
Mutual labels:  headless-chrome
Golang Chrome Automation
Automate Chrome tasks with Golang and ChromeDP
Stars: ✭ 58 (-51.26%)
Mutual labels:  headless-chrome
Navalia
A bullet-proof, fast, and reliable headless browser API
Stars: ✭ 950 (+698.32%)
Mutual labels:  headless-chrome
Chrome Devtools Protocol
Chrome Devtools Protocol client for PHP
Stars: ✭ 112 (-5.88%)
Mutual labels:  headless-chrome
Googlemeetbot
A simple Google meet bot so the bot can attend classes for you.
Stars: ✭ 49 (-58.82%)
Mutual labels:  headless-chrome
Mocha Chrome
☕️ Run Mocha tests using headless Google Chrome
Stars: ✭ 66 (-44.54%)
Mutual labels:  headless-chrome
Seodeploy
SEODeploy: Flexible and Modular Python Library for Automating SEO Testing in Deployment Pipelines.
Stars: ✭ 41 (-65.55%)
Mutual labels:  headless-chrome
Puphpeteer
A Puppeteer bridge for PHP, supporting the entire API.
Stars: ✭ 1,014 (+752.1%)
Mutual labels:  headless-chrome
Decapitated
Headless 'Chrome' Orchestration in R
Stars: ✭ 65 (-45.38%)
Mutual labels:  headless-chrome
Gowitness
🔍 gowitness - a golang, web screenshot utility using Chrome Headless
Stars: ✭ 996 (+736.97%)
Mutual labels:  headless-chrome
Puppeteer Functions
Puppeteer Firebase Functions demo
Stars: ✭ 75 (-36.97%)
Mutual labels:  headless-chrome
Prerender Alpine
Lightweight Prerender container built on Alpine Linux with Node and Headless Chrome
Stars: ✭ 38 (-68.07%)
Mutual labels:  headless-chrome
Crawlergo
A powerful dynamic crawler for web vulnerability scanners
Stars: ✭ 1,088 (+814.29%)
Mutual labels:  headless-chrome
Ayakashi
⚡️ Ayakashi.io - The next generation web scraping framework
Stars: ✭ 117 (-1.68%)
Mutual labels:  headless-chrome
Puppeteer Dart
A Dart library to automate the Chrome browser over the DevTools Protocol. This is a port of the Puppeteer API
Stars: ✭ 92 (-22.69%)
Mutual labels:  headless-chrome
Page2image
📷 page2image is a npm package for taking screenshots which also provides CLI command
Stars: ✭ 66 (-44.54%)
Mutual labels:  headless-chrome

cri - chrome remote interface

GoDoc Go Report Card Go Report Card

Package cri provides type-safe bindings for devtools protocol. It can be used with Chrome or any other target that implements the interface.

Protocol is generated by cmd/generate.sh. Script fetches latest version of protocol and generates types and domain (accessibility, domdebugger, performance etc.) packages. Master branch reflects tip of tree.

Tested with go1.4 and above.

Install

go get -u github.com/SKatiyar/cri

Usage

Taking a screenshot.

package main

import (
	"encoding/base64"
	"fmt"
	"io/ioutil"
  
	"github.com/SKatiyar/cri"
	"github.com/SKatiyar/cri/browser"
	"github.com/SKatiyar/cri/page"
)

func main() {
	conn, connErr := cri.NewConnection()
	if connErr != nil {
		fmt.Println(connErr)
		return
	}

	res, resErr := browser.New(conn).GetVersion()
	if resErr != nil {
		fmt.Println(resErr)
		return
	}

	pi := page.New(conn)
	if enableErr := pi.Enable(); enableErr != nil {
		fmt.Println(enableErr)
		return
	}

	nav, navErr := pi.Navigate(&page.NavigateRequest{
		Url: "https://www.example.com",
	})
	if navErr != nil {
		fmt.Println(navErr)
		return
	}

	pic, picErr := pi.CaptureScreenshot(nil)
	if picErr != nil {
		fmt.Println(picErr)
		return
	}

	img, imgErr := base64.StdEncoding.DecodeString(pic.Data)
	if imgErr != nil {
		fmt.Println(imgErr)
		return
	}

	if writeErr := ioutil.WriteFile("img.png", img, 0700); writeErr != nil {
		fmt.Println(writeErr)
		return
	}

	fmt.Println(res.JsVersion, nav.FrameId)
}

TODO

  • Add go get support to version 1.2 of protocol.
  • Add tests for connection.go
  • Add tests for domain packages.
  • Simplify On function.
  • Add timeout to On function.
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].