diff --git a/code2img.go b/code2img.go index d6d8f30..51d39d3 100644 --- a/code2img.go +++ b/code2img.go @@ -16,6 +16,7 @@ import ( "github.com/chromedp/cdproto/dom" "github.com/chromedp/cdproto/emulation" "github.com/chromedp/cdproto/page" + "github.com/chromedp/cdproto/runtime" "github.com/chromedp/chromedp" ) @@ -109,13 +110,13 @@ func screenshot(sel interface{}, picbuf *[]byte, opts ...chromedp.QueryOption) c panic("picbuf cannot be nil") } - return chromedp.QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error { + return chromedp.QueryAfter(sel, func(ctx context.Context, eci runtime.ExecutionContextID, nodes ...*cdp.Node) error { if len(nodes) < 1 { return fmt.Errorf("selector %q did not return any nodes", sel) } // get layout metrics - _, _, contentSize, err := page.GetLayoutMetrics().Do(ctx) + _, _, contentSize, _, _, _, err := page.GetLayoutMetrics().Do(ctx) if err != nil { return err } diff --git a/code2img_test.go b/code2img_test.go index 50b5392..2ee7363 100644 --- a/code2img_test.go +++ b/code2img_test.go @@ -19,7 +19,7 @@ import ( ) func TestRender(t *testing.T) { - ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() got, err := code2img.Render(ctx, code2img.LangGo, `import "golang.design/x/code2img"`)