// Package browser provides the Chrome DevTools Protocol// commands, types, and events for the Browser domain.//// The Browser domain defines methods and events for browser managing.//// Generated by the cdproto-gen command.
package browser// Code generated by cdproto-gen. DO NOT EDIT.import ()// SetPermissionParams set permission settings for given origin.typeSetPermissionParamsstruct { Permission *PermissionDescriptor`json:"permission"`// Descriptor of permission to override. Setting PermissionSetting`json:"setting"`// Setting of the permission. Origin string`json:"origin,omitempty"`// Origin the permission applies to, all origins if not specified. BrowserContextID cdp.BrowserContextID`json:"browserContextId,omitempty"`// Context to override. When omitted, default browser context is used.}// SetPermission set permission settings for given origin.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setPermission//// parameters://// permission - Descriptor of permission to override.// setting - Setting of the permission.func ( *PermissionDescriptor, PermissionSetting) *SetPermissionParams {return &SetPermissionParams{Permission: ,Setting: , }}// WithOrigin origin the permission applies to, all origins if not specified.func ( SetPermissionParams) ( string) *SetPermissionParams { .Origin = return &}// WithBrowserContextID context to override. When omitted, default browser// context is used.func ( SetPermissionParams) ( cdp.BrowserContextID) *SetPermissionParams { .BrowserContextID = return &}// Do executes Browser.setPermission against the provided context.func ( *SetPermissionParams) ( context.Context) ( error) {returncdp.Execute(, CommandSetPermission, , nil)}// GrantPermissionsParams grant specific permissions to the given origin and// reject all others.typeGrantPermissionsParamsstruct { Permissions []PermissionType`json:"permissions"` Origin string`json:"origin,omitempty"`// Origin the permission applies to, all origins if not specified. BrowserContextID cdp.BrowserContextID`json:"browserContextId,omitempty"`// BrowserContext to override permissions. When omitted, default browser context is used.}// GrantPermissions grant specific permissions to the given origin and reject// all others.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-grantPermissions//// parameters://// permissionsfunc ( []PermissionType) *GrantPermissionsParams {return &GrantPermissionsParams{Permissions: , }}// WithOrigin origin the permission applies to, all origins if not specified.func ( GrantPermissionsParams) ( string) *GrantPermissionsParams { .Origin = return &}// WithBrowserContextID browserContext to override permissions. When omitted,// default browser context is used.func ( GrantPermissionsParams) ( cdp.BrowserContextID) *GrantPermissionsParams { .BrowserContextID = return &}// Do executes Browser.grantPermissions against the provided context.func ( *GrantPermissionsParams) ( context.Context) ( error) {returncdp.Execute(, CommandGrantPermissions, , nil)}// ResetPermissionsParams reset all permission management for all origins.typeResetPermissionsParamsstruct { BrowserContextID cdp.BrowserContextID`json:"browserContextId,omitempty"`// BrowserContext to reset permissions. When omitted, default browser context is used.}// ResetPermissions reset all permission management for all origins.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-resetPermissions//// parameters:func () *ResetPermissionsParams {return &ResetPermissionsParams{}}// WithBrowserContextID browserContext to reset permissions. When omitted,// default browser context is used.func ( ResetPermissionsParams) ( cdp.BrowserContextID) *ResetPermissionsParams { .BrowserContextID = return &}// Do executes Browser.resetPermissions against the provided context.func ( *ResetPermissionsParams) ( context.Context) ( error) {returncdp.Execute(, CommandResetPermissions, , nil)}// SetDownloadBehaviorParams set the behavior when downloading a file.typeSetDownloadBehaviorParamsstruct { Behavior SetDownloadBehaviorBehavior`json:"behavior"`// Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). |allowAndName| allows download and names files according to their dowmload guids. BrowserContextID cdp.BrowserContextID`json:"browserContextId,omitempty"`// BrowserContext to set download behavior. When omitted, default browser context is used. DownloadPath string`json:"downloadPath,omitempty"`// The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'. EventsEnabled bool`json:"eventsEnabled,omitempty"`// Whether to emit download events (defaults to false).}// SetDownloadBehavior set the behavior when downloading a file.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setDownloadBehavior//// parameters://// behavior - Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). |allowAndName| allows download and names files according to their dowmload guids.func ( SetDownloadBehaviorBehavior) *SetDownloadBehaviorParams {return &SetDownloadBehaviorParams{Behavior: , }}// WithBrowserContextID browserContext to set download behavior. When// omitted, default browser context is used.func ( SetDownloadBehaviorParams) ( cdp.BrowserContextID) *SetDownloadBehaviorParams { .BrowserContextID = return &}// WithDownloadPath the default path to save downloaded files to. This is// required if behavior is set to 'allow' or 'allowAndName'.func ( SetDownloadBehaviorParams) ( string) *SetDownloadBehaviorParams { .DownloadPath = return &}// WithEventsEnabled whether to emit download events (defaults to false).func ( SetDownloadBehaviorParams) ( bool) *SetDownloadBehaviorParams { .EventsEnabled = return &}// Do executes Browser.setDownloadBehavior against the provided context.func ( *SetDownloadBehaviorParams) ( context.Context) ( error) {returncdp.Execute(, CommandSetDownloadBehavior, , nil)}// CancelDownloadParams cancel a download if in progress.typeCancelDownloadParamsstruct { GUID string`json:"guid"`// Global unique identifier of the download. BrowserContextID cdp.BrowserContextID`json:"browserContextId,omitempty"`// BrowserContext to perform the action in. When omitted, default browser context is used.}// CancelDownload cancel a download if in progress.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-cancelDownload//// parameters://// guid - Global unique identifier of the download.func ( string) *CancelDownloadParams {return &CancelDownloadParams{GUID: , }}// WithBrowserContextID browserContext to perform the action in. When// omitted, default browser context is used.func ( CancelDownloadParams) ( cdp.BrowserContextID) *CancelDownloadParams { .BrowserContextID = return &}// Do executes Browser.cancelDownload against the provided context.func ( *CancelDownloadParams) ( context.Context) ( error) {returncdp.Execute(, CommandCancelDownload, , nil)}// CloseParams close browser gracefully.typeCloseParamsstruct{}// Close close browser gracefully.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-closefunc () *CloseParams {return &CloseParams{}}// Do executes Browser.close against the provided context.func ( *CloseParams) ( context.Context) ( error) {returncdp.Execute(, CommandClose, nil, nil)}// CrashParams crashes browser on the main thread.typeCrashParamsstruct{}// Crash crashes browser on the main thread.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-crashfunc () *CrashParams {return &CrashParams{}}// Do executes Browser.crash against the provided context.func ( *CrashParams) ( context.Context) ( error) {returncdp.Execute(, CommandCrash, nil, nil)}// CrashGpuProcessParams crashes GPU process.typeCrashGpuProcessParamsstruct{}// CrashGpuProcess crashes GPU process.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-crashGpuProcessfunc () *CrashGpuProcessParams {return &CrashGpuProcessParams{}}// Do executes Browser.crashGpuProcess against the provided context.func ( *CrashGpuProcessParams) ( context.Context) ( error) {returncdp.Execute(, CommandCrashGpuProcess, nil, nil)}// GetVersionParams returns version information.typeGetVersionParamsstruct{}// GetVersion returns version information.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getVersionfunc () *GetVersionParams {return &GetVersionParams{}}// GetVersionReturns return values.typeGetVersionReturnsstruct { ProtocolVersion string`json:"protocolVersion,omitempty"`// Protocol version. Product string`json:"product,omitempty"`// Product name. Revision string`json:"revision,omitempty"`// Product revision. UserAgent string`json:"userAgent,omitempty"`// User-Agent. JsVersion string`json:"jsVersion,omitempty"`// V8 version.}// Do executes Browser.getVersion against the provided context.//// returns://// protocolVersion - Protocol version.// product - Product name.// revision - Product revision.// userAgent - User-Agent.// jsVersion - V8 version.func ( *GetVersionParams) ( context.Context) ( string, string, string, string, string, error) {// executevarGetVersionReturns = cdp.Execute(, CommandGetVersion, nil, &)if != nil {return"", "", "", "", "", }return .ProtocolVersion, .Product, .Revision, .UserAgent, .JsVersion, nil}// GetBrowserCommandLineParams returns the command line switches for the// browser process if, and only if --enable-automation is on the commandline.typeGetBrowserCommandLineParamsstruct{}// GetBrowserCommandLine returns the command line switches for the browser// process if, and only if --enable-automation is on the commandline.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getBrowserCommandLinefunc () *GetBrowserCommandLineParams {return &GetBrowserCommandLineParams{}}// GetBrowserCommandLineReturns return values.typeGetBrowserCommandLineReturnsstruct { Arguments []string`json:"arguments,omitempty"`// Commandline parameters}// Do executes Browser.getBrowserCommandLine against the provided context.//// returns://// arguments - Commandline parametersfunc ( *GetBrowserCommandLineParams) ( context.Context) ( []string, error) {// executevarGetBrowserCommandLineReturns = cdp.Execute(, CommandGetBrowserCommandLine, nil, &)if != nil {returnnil, }return .Arguments, nil}// GetHistogramsParams get Chrome histograms.typeGetHistogramsParamsstruct { Query string`json:"query,omitempty"`// Requested substring in name. Only histograms which have query as a substring in their name are extracted. An empty or absent query returns all histograms. Delta bool`json:"delta,omitempty"`// If true, retrieve delta since last delta call.}// GetHistograms get Chrome histograms.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getHistograms//// parameters:func () *GetHistogramsParams {return &GetHistogramsParams{}}// WithQuery requested substring in name. Only histograms which have query as// a substring in their name are extracted. An empty or absent query returns all// histograms.func ( GetHistogramsParams) ( string) *GetHistogramsParams { .Query = return &}// WithDelta if true, retrieve delta since last delta call.func ( GetHistogramsParams) ( bool) *GetHistogramsParams { .Delta = return &}// GetHistogramsReturns return values.typeGetHistogramsReturnsstruct { Histograms []*Histogram`json:"histograms,omitempty"`// Histograms.}// Do executes Browser.getHistograms against the provided context.//// returns://// histograms - Histograms.func ( *GetHistogramsParams) ( context.Context) ( []*Histogram, error) {// executevarGetHistogramsReturns = cdp.Execute(, CommandGetHistograms, , &)if != nil {returnnil, }return .Histograms, nil}// GetHistogramParams get a Chrome histogram by name.typeGetHistogramParamsstruct { Name string`json:"name"`// Requested histogram name. Delta bool`json:"delta,omitempty"`// If true, retrieve delta since last delta call.}// GetHistogram get a Chrome histogram by name.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getHistogram//// parameters://// name - Requested histogram name.func ( string) *GetHistogramParams {return &GetHistogramParams{Name: , }}// WithDelta if true, retrieve delta since last delta call.func ( GetHistogramParams) ( bool) *GetHistogramParams { .Delta = return &}// GetHistogramReturns return values.typeGetHistogramReturnsstruct { Histogram *Histogram`json:"histogram,omitempty"`// Histogram.}// Do executes Browser.getHistogram against the provided context.//// returns://// histogram - Histogram.func ( *GetHistogramParams) ( context.Context) ( *Histogram, error) {// executevarGetHistogramReturns = cdp.Execute(, CommandGetHistogram, , &)if != nil {returnnil, }return .Histogram, nil}// GetWindowBoundsParams get position and size of the browser window.typeGetWindowBoundsParamsstruct { WindowID WindowID`json:"windowId"`// Browser window id.}// GetWindowBounds get position and size of the browser window.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getWindowBounds//// parameters://// windowID - Browser window id.func ( WindowID) *GetWindowBoundsParams {return &GetWindowBoundsParams{WindowID: , }}// GetWindowBoundsReturns return values.typeGetWindowBoundsReturnsstruct { Bounds *Bounds`json:"bounds,omitempty"`// Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.}// Do executes Browser.getWindowBounds against the provided context.//// returns://// bounds - Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.func ( *GetWindowBoundsParams) ( context.Context) ( *Bounds, error) {// executevarGetWindowBoundsReturns = cdp.Execute(, CommandGetWindowBounds, , &)if != nil {returnnil, }return .Bounds, nil}// GetWindowForTargetParams get the browser window that contains the devtools// target.typeGetWindowForTargetParamsstruct { TargetID target.ID`json:"targetId,omitempty"`// Devtools agent host id. If called as a part of the session, associated targetId is used.}// GetWindowForTarget get the browser window that contains the devtools// target.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getWindowForTarget//// parameters:func () *GetWindowForTargetParams {return &GetWindowForTargetParams{}}// WithTargetID devtools agent host id. If called as a part of the session,// associated targetId is used.func ( GetWindowForTargetParams) ( target.ID) *GetWindowForTargetParams { .TargetID = return &}// GetWindowForTargetReturns return values.typeGetWindowForTargetReturnsstruct { WindowID WindowID`json:"windowId,omitempty"`// Browser window id. Bounds *Bounds`json:"bounds,omitempty"`// Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.}// Do executes Browser.getWindowForTarget against the provided context.//// returns://// windowID - Browser window id.// bounds - Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.func ( *GetWindowForTargetParams) ( context.Context) ( WindowID, *Bounds, error) {// executevarGetWindowForTargetReturns = cdp.Execute(, CommandGetWindowForTarget, , &)if != nil {return0, nil, }return .WindowID, .Bounds, nil}// SetWindowBoundsParams set position and/or size of the browser window.typeSetWindowBoundsParamsstruct { WindowID WindowID`json:"windowId"`// Browser window id. Bounds *Bounds`json:"bounds"`// New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.}// SetWindowBounds set position and/or size of the browser window.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setWindowBounds//// parameters://// windowID - Browser window id.// bounds - New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.func ( WindowID, *Bounds) *SetWindowBoundsParams {return &SetWindowBoundsParams{WindowID: ,Bounds: , }}// Do executes Browser.setWindowBounds against the provided context.func ( *SetWindowBoundsParams) ( context.Context) ( error) {returncdp.Execute(, CommandSetWindowBounds, , nil)}// SetDockTileParams set dock tile details, platform-specific.typeSetDockTileParamsstruct { BadgeLabel string`json:"badgeLabel,omitempty"` Image string`json:"image,omitempty"`// Png encoded image.}// SetDockTile set dock tile details, platform-specific.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setDockTile//// parameters:func () *SetDockTileParams {return &SetDockTileParams{}}// WithBadgeLabel [no description].func ( SetDockTileParams) ( string) *SetDockTileParams { .BadgeLabel = return &}// WithImage png encoded image.func ( SetDockTileParams) ( string) *SetDockTileParams { .Image = return &}// Do executes Browser.setDockTile against the provided context.func ( *SetDockTileParams) ( context.Context) ( error) {returncdp.Execute(, CommandSetDockTile, , nil)}// ExecuteBrowserCommandParams invoke custom browser commands used by// telemetry.typeExecuteBrowserCommandParamsstruct { CommandID CommandID`json:"commandId"`}// ExecuteBrowserCommand invoke custom browser commands used by telemetry.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-executeBrowserCommand//// parameters://// commandIDfunc ( CommandID) *ExecuteBrowserCommandParams {return &ExecuteBrowserCommandParams{CommandID: , }}// Do executes Browser.executeBrowserCommand against the provided context.func ( *ExecuteBrowserCommandParams) ( context.Context) ( error) {returncdp.Execute(, CommandExecuteBrowserCommand, , nil)}// AddPrivacySandboxEnrollmentOverrideParams allows a site to use privacy// sandbox features that require enrollment without the site actually being// enrolled. Only supported on page targets.typeAddPrivacySandboxEnrollmentOverrideParamsstruct { URL string`json:"url"`}// AddPrivacySandboxEnrollmentOverride allows a site to use privacy sandbox// features that require enrollment without the site actually being enrolled.// Only supported on page targets.//// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-addPrivacySandboxEnrollmentOverride//// parameters://// urlfunc ( string) *AddPrivacySandboxEnrollmentOverrideParams {return &AddPrivacySandboxEnrollmentOverrideParams{URL: , }}// Do executes Browser.addPrivacySandboxEnrollmentOverride against the provided context.func ( *AddPrivacySandboxEnrollmentOverrideParams) ( context.Context) ( error) {returncdp.Execute(, CommandAddPrivacySandboxEnrollmentOverride, , nil)}// Command names.const (CommandSetPermission = "Browser.setPermission"CommandGrantPermissions = "Browser.grantPermissions"CommandResetPermissions = "Browser.resetPermissions"CommandSetDownloadBehavior = "Browser.setDownloadBehavior"CommandCancelDownload = "Browser.cancelDownload"CommandClose = "Browser.close"CommandCrash = "Browser.crash"CommandCrashGpuProcess = "Browser.crashGpuProcess"CommandGetVersion = "Browser.getVersion"CommandGetBrowserCommandLine = "Browser.getBrowserCommandLine"CommandGetHistograms = "Browser.getHistograms"CommandGetHistogram = "Browser.getHistogram"CommandGetWindowBounds = "Browser.getWindowBounds"CommandGetWindowForTarget = "Browser.getWindowForTarget"CommandSetWindowBounds = "Browser.setWindowBounds"CommandSetDockTile = "Browser.setDockTile"CommandExecuteBrowserCommand = "Browser.executeBrowserCommand"CommandAddPrivacySandboxEnrollmentOverride = "Browser.addPrivacySandboxEnrollmentOverride")
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.