mirror of
https://github.com/tenox7/wrp.git
synced 2024-11-21 19:30:48 +00:00
move chromedp.Sleep to just before screenshot to fix render issue
This commit is contained in:
parent
5dc4699ac9
commit
b54ebbf9e5
6
wrp.go
6
wrp.go
@ -314,7 +314,6 @@ func (w wrpReq) capture() {
|
||||
var pngcap []byte
|
||||
chromedp.Run(ctx,
|
||||
emulation.SetDeviceMetricsOverride(int64(float64(w.width)/w.scale), 10, w.scale, false),
|
||||
chromedp.Sleep(time.Second*2),
|
||||
chromedp.Location(&w.url),
|
||||
chromedp.ComputedStyle("body", &styles, chromedp.ByQuery),
|
||||
chromedp.ActionFunc(func(ctx context.Context) error {
|
||||
@ -338,7 +337,10 @@ func (w wrpReq) capture() {
|
||||
}
|
||||
chromedp.Run(ctx, emulation.SetDeviceMetricsOverride(int64(float64(w.width)/w.scale), height, w.scale, false))
|
||||
// Capture screenshot...
|
||||
err = chromedp.Run(ctx, chromedp.CaptureScreenshot(&pngcap))
|
||||
err = chromedp.Run(ctx,
|
||||
chromedp.Sleep(time.Second*2),
|
||||
chromedp.CaptureScreenshot(&pngcap),
|
||||
)
|
||||
if err != nil {
|
||||
if err.Error() == "context canceled" {
|
||||
log.Printf("%s Contex cancelled, try again", w.req.RemoteAddr)
|
||||
|
Loading…
Reference in New Issue
Block a user