Skip to Content
UsageCDPChromedp

Chromedp

Use Lightpanda with Chromedp, a Go client for the Chrome DevTools Protocol (CDP).

More examples in demo/chromedp.

Start Lightpanda as a local CDP server (see serve command for all options):

./lightpanda serve --host 127.0.0.1 --port 9222

Connect Chromedp using NewRemoteAllocator:

package main import ( "context" "flag" "log" "github.com/chromedp/chromedp" ) func main() { ctx, cancel = chromedp.NewRemoteAllocator(ctx, "ws://127.0.0.1:9222", chromedp.NoModifyURL, ) defer cancel() ctx, cancel := chromedp.NewContext(allocatorContext) defer cancel() var title string if err := chromedp.Run(ctx, chromedp.Navigate("https://wikipedia.com/"), chromedp.Title(&title), ); err != nil { log.Fatalf("Failed getting page's title: %v", err) } log.Println("Got title of:", title) }