From 4c05535a13b8dc9876975a1c3c742053b77d3142 Mon Sep 17 00:00:00 2001 From: bnkai <48220860+bnkai@users.noreply.github.com> Date: Mon, 28 Jun 2021 03:36:51 +0300 Subject: [PATCH] Fix potential race condintion in CDP (#1536) --- pkg/scraper/url.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pkg/scraper/url.go b/pkg/scraper/url.go index baa35b07e..4fc78caf9 100644 --- a/pkg/scraper/url.go +++ b/pkg/scraper/url.go @@ -15,7 +15,6 @@ import ( "time" "github.com/chromedp/cdproto/cdp" - "github.com/chromedp/cdproto/dom" "github.com/chromedp/cdproto/network" "github.com/chromedp/chromedp" jsoniter "github.com/json-iterator/go" @@ -175,14 +174,7 @@ func urlFromCDP(url string, driverOptions scraperDriverOptions, globalConfig Glo chromedp.Navigate(url), chromedp.Sleep(sleepDuration), setCDPClicks(driverOptions), - chromedp.ActionFunc(func(ctx context.Context) error { - node, err := dom.GetDocument().Do(ctx) - if err != nil { - return err - } - res, err = dom.GetOuterHTML().WithNodeID(node.NodeID).Do(ctx) - return err - }), + chromedp.OuterHTML("html", &res, chromedp.ByQuery), printCDPCookies(driverOptions, "Cookies set"), )