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
Please proceed to the examples directory
go get github.com/jarylc/go-chromedpproxy
// 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)
// ...
Please refer to chromedp/chromedp repository for general chromedp
usage
See the open issues for a list of proposed features (and known issues).
Feel free to fork the repository and submit pull requests.
Distributed under the GNU GENERAL PUBLIC LICENSE V3. See LICENSE
for more information.
Jaryl Chng - git@jarylchng.com