Categorygithub.com/jarylc/go-chromedpproxy
modulepackage
0.2.1
Repository: https://github.com/jarylc/go-chromedpproxy.git
Documentation: pkg.go.dev

# README

ChromeDP Proxy

Go ChromeDPProxy

Inspired by claabs/puppeteer-extra-plugin-portal

A Go module for a ChromeDP abstraction layer that additionally hosts a webserver to remotely view ChromeDP sessions. Essentially opening a "portal" to the page. Perfect for Go automations that require manual intervention.

IMPORTANT: You must install xvfb on the system / docker container

Report Bugs · Request Features

About The Project

Built With

Examples

Please proceed to the examples directory

Getting Started

Installing

go get github.com/jarylc/go-chromedpproxy

Usage

Basic

// step 1 - prepare proxy
// change `:9222` to your desired Chrome remote debugging port
// change `:9221` to your desired webserver port for the front-end
// append and/or remove `chromedp.DisableGPU` with your desired allocated executor options as additional arguments
chromedpproxy.PrepareProxy(":9222", ":9221", chromedp.DisableGPU)

// step 2 - launch a tab target
// append and/or remove `chromedp.WithLogf(log.Printf)` with your desired context options as additional arguments
targetID, err := chromedpproxy.NewTab("https://www.google.com/recaptcha/api2/demo", chromedp.WithLogf(log.Printf))
if err != nil && !errors.Is(err, context.Canceled) {
    log.Fatal(err)
}
defer chromedpproxy.CloseTarget(targetID)

// step 3 - get context and do whatever you need, you can refer to the examples directory of the project
ctx := chromedpproxy.GetTarget(targetID)
// ...

ChromeDP

Please refer to chromedp/chromedp repository for general chromedp usage

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Feel free to fork the repository and submit pull requests.

License

Distributed under the GNU GENERAL PUBLIC LICENSE V3. See LICENSE for more information.

Contact

Jaryl Chng - [email protected]

https://jarylchng.com

# Packages

No description provided by the author

# Functions

CloseTarget closes a target by closing the page if the last page has been closed, clean up everything it returns an error if any.
GetTarget returns a context from a target ID.
NewTab abstracts creating a new tab in the root context it returns a target ID or error.
PrepareProxy abstracts chromedp.NewExecAllocator to the use case of this package it accepts listen addresses for both Chrome remote debugging and frontend as configuration it is also a variadic function that accepts extra chromedp.ExecAllocatorOption to be passed to the chromedp.NewExecAllocator.