func (c *Page) CaptureSnapshot(format string) (string, error) {
	var v PageCaptureSnapshotParams
	v.Format = format
	return c.CaptureSnapshotWithParams(&v)
}
CaptureSnapshot - Returns a snapshot of the page as a string. For MHTML format, the serialization includes iframes, shadow DOM, external resources, and element-inline styles.
format - Format (defaults to mhtml).
Returns -  data - Serialized page data.
package gcdapi
import (
	"encoding/json"
	"github.com/wirepair/gcd/gcdmessage"
)
type PageFrame struct {
	Id             string `json:"id"`                        
	ParentId       string `json:"parentId,omitempty"`        
	LoaderId       string `json:"loaderId"`                  
	Name           string `json:"name,omitempty"`            
	Url            string `json:"url"`                       
	SecurityOrigin string `json:"securityOrigin"`            
	MimeType       string `json:"mimeType"`                  
	UnreachableUrl string `json:"unreachableUrl,omitempty"`  
}
type PageFrameResource struct {
	Url          string  `json:"url"`                     
	Type         string  `json:"type"`                    
	MimeType     string  `json:"mimeType"`                
	LastModified float64 `json:"lastModified,omitempty"`  
	ContentSize  float64 `json:"contentSize,omitempty"`   
	Failed       bool    `json:"failed,omitempty"`        
	Canceled     bool    `json:"canceled,omitempty"`      
}
type PageFrameResourceTree struct {
	Frame       *PageFrame               `json:"frame"`                  
	ChildFrames []*PageFrameResourceTree `json:"childFrames,omitempty"`  
	Resources   []*PageFrameResource     `json:"resources"`              
}
type PageFrameTree struct {
	Frame       *PageFrame       `json:"frame"`                  
	ChildFrames []*PageFrameTree `json:"childFrames,omitempty"`  
}
type PageNavigationEntry struct {
	Id             int    `json:"id"`              
	Url            string `json:"url"`             
	UserTypedURL   string `json:"userTypedURL"`    
	Title          string `json:"title"`           
	TransitionType string `json:"transitionType"`  
}
type PageScreencastFrameMetadata struct {
	OffsetTop       float64 `json:"offsetTop"`            
	PageScaleFactor float64 `json:"pageScaleFactor"`      
	DeviceWidth     float64 `json:"deviceWidth"`          
	DeviceHeight    float64 `json:"deviceHeight"`         
	ScrollOffsetX   float64 `json:"scrollOffsetX"`        
	ScrollOffsetY   float64 `json:"scrollOffsetY"`        
	Timestamp       float64 `json:"timestamp,omitempty"`  
}
type PageAppManifestError struct {
	Message  string `json:"message"`   
	Critical int    `json:"critical"`  
	Line     int    `json:"line"`      
	Column   int    `json:"column"`    
}
type PageLayoutViewport struct {
	PageX        int `json:"pageX"`         
	PageY        int `json:"pageY"`         
	ClientWidth  int `json:"clientWidth"`   
	ClientHeight int `json:"clientHeight"`  
}
type PageVisualViewport struct {
	OffsetX      float64 `json:"offsetX"`       
	OffsetY      float64 `json:"offsetY"`       
	PageX        float64 `json:"pageX"`         
	PageY        float64 `json:"pageY"`         
	ClientWidth  float64 `json:"clientWidth"`   
	ClientHeight float64 `json:"clientHeight"`  
	Scale        float64 `json:"scale"`         
}
type PageViewport struct {
	X      float64 `json:"x"`       
	Y      float64 `json:"y"`       
	Width  float64 `json:"width"`   
	Height float64 `json:"height"`  
	Scale  float64 `json:"scale"`   
}
type PageFontFamilies struct {
	Standard   string `json:"standard,omitempty"`    
	Fixed      string `json:"fixed,omitempty"`       
	Serif      string `json:"serif,omitempty"`       
	SansSerif  string `json:"sansSerif,omitempty"`   
	Cursive    string `json:"cursive,omitempty"`     
	Fantasy    string `json:"fantasy,omitempty"`     
	Pictograph string `json:"pictograph,omitempty"`  
}
type PageFontSizes struct {
	Standard int `json:"standard,omitempty"`  
	Fixed    int `json:"fixed,omitempty"`     
}
type PageDomContentEventFiredEvent struct {
	Method string `json:"method"`
	Params struct {
		Timestamp float64 `json:"timestamp"`  
	} `json:"Params,omitempty"`
}
type PageFrameAttachedEvent struct {
	Method string `json:"method"`
	Params struct {
		FrameId       string             `json:"frameId"`          
		ParentFrameId string             `json:"parentFrameId"`    
		Stack         *RuntimeStackTrace `json:"stack,omitempty"`  
	} `json:"Params,omitempty"`
}
type PageFrameClearedScheduledNavigationEvent struct {
	Method string `json:"method"`
	Params struct {
		FrameId string `json:"frameId"`  
	} `json:"Params,omitempty"`
}
type PageFrameDetachedEvent struct {
	Method string `json:"method"`
	Params struct {
		FrameId string `json:"frameId"`  
	} `json:"Params,omitempty"`
}
type PageFrameNavigatedEvent struct {
	Method string `json:"method"`
	Params struct {
		Frame *PageFrame `json:"frame"`  
	} `json:"Params,omitempty"`
}
type PageFrameScheduledNavigationEvent struct {
	Method string `json:"method"`
	Params struct {
		FrameId string  `json:"frameId"`  
		Delay   float64 `json:"delay"`    
		Reason  string  `json:"reason"`   
		Url     string  `json:"url"`      
	} `json:"Params,omitempty"`
}
type PageFrameStartedLoadingEvent struct {
	Method string `json:"method"`
	Params struct {
		FrameId string `json:"frameId"`  
	} `json:"Params,omitempty"`
}
type PageFrameStoppedLoadingEvent struct {
	Method string `json:"method"`
	Params struct {
		FrameId string `json:"frameId"`  
	} `json:"Params,omitempty"`
}
type PageJavascriptDialogClosedEvent struct {
	Method string `json:"method"`
	Params struct {
		Result    bool   `json:"result"`     
		UserInput string `json:"userInput"`  
	} `json:"Params,omitempty"`
}
type PageJavascriptDialogOpeningEvent struct {
	Method string `json:"method"`
	Params struct {
		Url               string `json:"url"`                      
		Message           string `json:"message"`                  
		Type              string `json:"type"`                     
		HasBrowserHandler bool   `json:"hasBrowserHandler"`        
		DefaultPrompt     string `json:"defaultPrompt,omitempty"`  
	} `json:"Params,omitempty"`
}
type PageLifecycleEventEvent struct {
	Method string `json:"method"`
	Params struct {
		FrameId   string  `json:"frameId"`    
		LoaderId  string  `json:"loaderId"`   
		Name      string  `json:"name"`       
		Timestamp float64 `json:"timestamp"`  
	} `json:"Params,omitempty"`
}
type PageLoadEventFiredEvent struct {
	Method string `json:"method"`
	Params struct {
		Timestamp float64 `json:"timestamp"`  
	} `json:"Params,omitempty"`
}
type PageNavigatedWithinDocumentEvent struct {
	Method string `json:"method"`
	Params struct {
		FrameId string `json:"frameId"`  
		Url     string `json:"url"`      
	} `json:"Params,omitempty"`
}
type PageScreencastFrameEvent struct {
	Method string `json:"method"`
	Params struct {
		Data      string                       `json:"data"`       
		Metadata  *PageScreencastFrameMetadata `json:"metadata"`   
		SessionId int                          `json:"sessionId"`  
	} `json:"Params,omitempty"`
}
type PageScreencastVisibilityChangedEvent struct {
	Method string `json:"method"`
	Params struct {
		Visible bool `json:"visible"`  
	} `json:"Params,omitempty"`
}
type PageWindowOpenEvent struct {
	Method string `json:"method"`
	Params struct {
		Url            string   `json:"url"`             
		WindowName     string   `json:"windowName"`      
		WindowFeatures []string `json:"windowFeatures"`  
		UserGesture    bool     `json:"userGesture"`     
	} `json:"Params,omitempty"`
}
type PageCompilationCacheProducedEvent struct {
	Method string `json:"method"`
	Params struct {
		Url  string `json:"url"`   
		Data string `json:"data"`  
	} `json:"Params,omitempty"`
}
type Page struct {
	target gcdmessage.ChromeTargeter
}
func NewPage(target gcdmessage.ChromeTargeter) *Page {
	c := &Page{target: target}
	return c
}
type PageAddScriptToEvaluateOnLoadParams struct {
	ScriptSource string `json:"scriptSource"`
}
func (c *Page) AddScriptToEvaluateOnLoadWithParams(v *PageAddScriptToEvaluateOnLoadParams) (string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Page.addScriptToEvaluateOnLoad", Params: v})
	if err != nil {
		return "", err
	}
	var chromeData struct {
		Result struct {
			Identifier string
		}
	}
	if resp == nil {
		return "", &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", err
	}
	return chromeData.Result.Identifier, nil
}
func (c *Page) AddScriptToEvaluateOnLoad(scriptSource string) (string, error) {
	var v PageAddScriptToEvaluateOnLoadParams
	v.ScriptSource = scriptSource
	return c.AddScriptToEvaluateOnLoadWithParams(&v)
}
type PageAddScriptToEvaluateOnNewDocumentParams struct {
	Source string `json:"source"`
	WorldName string `json:"worldName,omitempty"`
}
func (c *Page) AddScriptToEvaluateOnNewDocumentWithParams(v *PageAddScriptToEvaluateOnNewDocumentParams) (string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Page.addScriptToEvaluateOnNewDocument", Params: v})
	if err != nil {
		return "", err
	}
	var chromeData struct {
		Result struct {
			Identifier string
		}
	}
	if resp == nil {
		return "", &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", err
	}
	return chromeData.Result.Identifier, nil
}
func (c *Page) AddScriptToEvaluateOnNewDocument(source string, worldName string) (string, error) {
	var v PageAddScriptToEvaluateOnNewDocumentParams
	v.Source = source
	v.WorldName = worldName
	return c.AddScriptToEvaluateOnNewDocumentWithParams(&v)
}
func (c *Page) BringToFront() (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Page.bringToFront"})
}
type PageCaptureScreenshotParams struct {
	Format string `json:"format,omitempty"`
	Quality int `json:"quality,omitempty"`
	Clip *PageViewport `json:"clip,omitempty"`
	FromSurface bool `json:"fromSurface,omitempty"`
}
func (c *Page) CaptureScreenshotWithParams(v *PageCaptureScreenshotParams) (string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Page.captureScreenshot", Params: v})
	if err != nil {
		return "", err
	}
	var chromeData struct {
		Result struct {
			Data string
		}
	}
	if resp == nil {
		return "", &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", err
	}
	return chromeData.Result.Data, nil
}
func (c *Page) CaptureScreenshot(format string, quality int, clip *PageViewport, fromSurface bool) (string, error) {
	var v PageCaptureScreenshotParams
	v.Format = format
	v.Quality = quality
	v.Clip = clip
	v.FromSurface = fromSurface
	return c.CaptureScreenshotWithParams(&v)
}
type PageCaptureSnapshotParams struct {
	Format string `json:"format,omitempty"`
}
func (c *Page) CaptureSnapshotWithParams(v *PageCaptureSnapshotParams) (string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Page.captureSnapshot", Params: v})
	if err != nil {
		return "", err
	}
	var chromeData struct {
		Result struct {
			Data string
		}
	}
	if resp == nil {
		return "", &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", err
	}
	return chromeData.Result.Data, nil
}