diff --git a/wrp.go b/wrp.go index 196b3cb..5e75af1 100644 --- a/wrp.go +++ b/wrp.go @@ -106,7 +106,7 @@ func capture(gourl string, w int64, h int64, s float64, y int64, out http.Respon log.Printf("Processing Caputure Request for %s\n", gourl) // Run ChromeDP Magic - chromedp.Run(ctx, + err := chromedp.Run(ctx, emulation.SetDeviceMetricsOverride(w, h, s, false), chromedp.Navigate(gourl), chromedp.Evaluate(fmt.Sprintf("window.scrollTo(0, %d);", y), &res), @@ -115,6 +115,12 @@ func capture(gourl string, w int64, h int64, s float64, y int64, out http.Respon chromedp.Location(&loc), chromedp.Nodes("a", &nodes, chromedp.ByQueryAll)) + if err != nil { + log.Printf("%s", err) + fmt.Fprintf(out, "
%s
", err) + return + } + log.Printf("Landed on: %s, Nodes: %d\n", loc, len(nodes)) // Process Screenshot Image