add browser size setting

This commit is contained in:
Antoni Sawicki 2019-05-29 02:39:06 -07:00
parent 0680b4a72e
commit 5b827bffb0

4
wrp.go
View File

@ -10,6 +10,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/chromedp/cdproto/emulation"
"github.com/chromedp/cdproto/cdp" "github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/dom" "github.com/chromedp/cdproto/dom"
"github.com/chromedp/chromedp" "github.com/chromedp/chromedp"
@ -54,7 +56,9 @@ func capture(url string, out http.ResponseWriter) {
var target string var target string
log.Printf("Caputure Request for %s\n", url) log.Printf("Caputure Request for %s\n", url)
chromedp.Run(ctx, chromedp.Run(ctx,
emulation.SetDeviceMetricsOverride(1024, 768, 1.0, false),
chromedp.Navigate(url), chromedp.Navigate(url),
chromedp.Sleep(time.Second*2), chromedp.Sleep(time.Second*2),
chromedp.CaptureScreenshot(&scrcap), chromedp.CaptureScreenshot(&scrcap),