-
Notifications
You must be signed in to change notification settings - Fork 17
chrome.socket.Page.CaptureScreenshot
Michael Kenney edited this page Sep 29, 2018
·
1 revision
package main
import (
chrome "github.com/mkenney/go-chrome/tot"
"github.com/mkenney/go-chrome/tot/emulation"
"github.com/mkenney/go-chrome/tot/page"
)
func main() {
var err error
// ... snip ... //
// Set the device emulation parameters
metricsOverride := <-tab.Emulation().SetDeviceMetricsOverride(
&emulation.SetDeviceMetricsOverrideParams{
Width: 1440,
Height: 1440,
ScreenOrientation: &emulation.ScreenOrientation{
Type: emulation.OrientationType.PortraitPrimary,
Angle: 90,
},
},
)
if nil != metricsOverride.Err {
panic(metricsOverride.Err.Error())
}
// Capture the current screenshot
screenshot := <-tab.Page().CaptureScreenshot(
&page.CaptureScreenshotParams{
Format: page.Format.Jpeg,
Quality: 50,
},
)
if nil != screenshot.Err {
panic(screenshot.Err.Error())
}
}
"When the eagle flies, does it forget that its feet have touched the ground? When the tiger lands upon its prey, does it forget its moment in the air? Three pounds of VAX!"