Chromedp: Insecure hosts screenshot fails

Created on 16 Oct 2019  路  2Comments  路  Source: chromedp/chromedp

What versions are you running?

$ go list -m github.com/chromedp/chromedp
master branch
$ google-chrome --version
Google Chrome 77.0.3865.120  -- on Debian 10
Google Chrome 77.0.3865.120  -- on macOS 10.14.6
$ go version
go version go1.13 linux/amd64
go version go1.13.1 darwin/amd64

What did you do? Include clear steps.

I was trying the example to take a screenshot from here.
It works perfect for google.com, for example but it fails if it's an insecure certificate or self-signed one.

What did you expect to see?

I expect a screenshot also if the site is not secure

What did you see instead?

A blank screenshot, without content.

Most helpful comment

Okay I figured out checking past issues:

        opts := append(chromedp.DefaultExecAllocatorOptions[:],
        chromedp.Flag("ignore-certificate-errors", "1"),
    )
    allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
    defer cancel()
    ctx, cancel := chromedp.NewContext(allocCtx, chromedp.WithLogf(log.Printf))
    defer cancel()

    err = chromedp.Run(ctx, fullScreenshot(url, 10, &buf))

All 2 comments

Working URL: https://facebook.com

good

Non-working URL: https://self-signed.badssl.com

bad

(It's just a blank image)

While the expect result should be:

expected

Okay I figured out checking past issues:

        opts := append(chromedp.DefaultExecAllocatorOptions[:],
        chromedp.Flag("ignore-certificate-errors", "1"),
    )
    allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
    defer cancel()
    ctx, cancel := chromedp.NewContext(allocCtx, chromedp.WithLogf(log.Printf))
    defer cancel()

    err = chromedp.Run(ctx, fullScreenshot(url, 10, &buf))
Was this page helpful?
0 / 5 - 0 ratings

Related issues

seanchann picture seanchann  路  3Comments

vdobler picture vdobler  路  4Comments

donfrigo picture donfrigo  路  4Comments

guotie picture guotie  路  3Comments

youshy picture youshy  路  5Comments