You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Screenshot of the area of the elementfunc (el*Element) Screenshot(format proto.PageCaptureScreenshotFormat, qualityint) ([]byte, error) {
err:=el.ScrollIntoView()
iferr!=nil {
returnnil, err
}
opts:=&proto.PageCaptureScreenshot{
Quality: gson.Int(quality),
Format: format,
}
//page full Screenshot Notice :The device resolution is inconsistent with the display resolutionbin, err:=el.page.Context(el.ctx).Screenshot(false, opts)
iferr!=nil {
returnnil, err
}
// so that it won't clip the css-transformed elementshape, err:=el.Shape()
iferr!=nil {
returnnil, err
}
box:=shape.Box() // get el box // TODO: proto.PageCaptureScreenshot has a Clip option, but it's buggy, so now we do in Go.// cut the Screenshot ,but this box x/y, Width/Height are inconsistent with the resolution. Will cause screenshot error// window.devicePixelRatio is not 1,in Emulate that is 3returnutils.CropImage(bin, quality,
int(box.X),
int(box.Y),
int(box.Width),
int(box.Height),
)
}
Rod Version: v0.114.6
Need to recalculate coordinates to take screenshot correctly
The text was updated successfully, but these errors were encountered:
Rod Version: v0.114.6
Need to recalculate coordinates to take screenshot correctly
The text was updated successfully, but these errors were encountered: