// 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. type SetPermissionParams struct { 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) { return cdp.Execute(, CommandSetPermission, , nil) } // GrantPermissionsParams grant specific permissions to the given origin and // reject all others. type GrantPermissionsParams struct { 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: // // permissions func ( []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) { return cdp.Execute(, CommandGrantPermissions, , nil) } // ResetPermissionsParams reset all permission management for all origins. type ResetPermissionsParams struct { 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) { return cdp.Execute(, CommandResetPermissions, , nil) } // SetDownloadBehaviorParams set the behavior when downloading a file. type SetDownloadBehaviorParams struct { 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) { return cdp.Execute(, CommandSetDownloadBehavior, , nil) } // CancelDownloadParams cancel a download if in progress. type CancelDownloadParams struct { 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) { return cdp.Execute(, CommandCancelDownload, , nil) } // CloseParams close browser gracefully. type CloseParams struct{} // Close close browser gracefully. // // See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-close func () *CloseParams { return &CloseParams{} } // Do executes Browser.close against the provided context. func ( *CloseParams) ( context.Context) ( error) { return cdp.Execute(, CommandClose, nil, nil) } // CrashParams crashes browser on the main thread. type CrashParams struct{} // Crash crashes browser on the main thread. // // See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-crash func () *CrashParams { return &CrashParams{} } // Do executes Browser.crash against the provided context. func ( *CrashParams) ( context.Context) ( error) { return cdp.Execute(, CommandCrash, nil, nil) } // CrashGpuProcessParams crashes GPU process. type CrashGpuProcessParams struct{} // CrashGpuProcess crashes GPU process. // // See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-crashGpuProcess func () *CrashGpuProcessParams { return &CrashGpuProcessParams{} } // Do executes Browser.crashGpuProcess against the provided context. func ( *CrashGpuProcessParams) ( context.Context) ( error) { return cdp.Execute(, CommandCrashGpuProcess, nil, nil) } // GetVersionParams returns version information. type GetVersionParams struct{} // GetVersion returns version information. // // See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getVersion func () *GetVersionParams { return &GetVersionParams{} } // GetVersionReturns return values. type GetVersionReturns struct { 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) { // execute var GetVersionReturns = 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. type GetBrowserCommandLineParams struct{} // 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-getBrowserCommandLine func () *GetBrowserCommandLineParams { return &GetBrowserCommandLineParams{} } // GetBrowserCommandLineReturns return values. type GetBrowserCommandLineReturns struct { Arguments []string `json:"arguments,omitempty"` // Commandline parameters } // Do executes Browser.getBrowserCommandLine against the provided context. // // returns: // // arguments - Commandline parameters func ( *GetBrowserCommandLineParams) ( context.Context) ( []string, error) { // execute var GetBrowserCommandLineReturns = cdp.Execute(, CommandGetBrowserCommandLine, nil, &) if != nil { return nil, } return .Arguments, nil } // GetHistogramsParams get Chrome histograms. type GetHistogramsParams struct { 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. type GetHistogramsReturns struct { Histograms []*Histogram `json:"histograms,omitempty"` // Histograms. } // Do executes Browser.getHistograms against the provided context. // // returns: // // histograms - Histograms. func ( *GetHistogramsParams) ( context.Context) ( []*Histogram, error) { // execute var GetHistogramsReturns = cdp.Execute(, CommandGetHistograms, , &) if != nil { return nil, } return .Histograms, nil } // GetHistogramParams get a Chrome histogram by name. type GetHistogramParams struct { 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. type GetHistogramReturns struct { Histogram *Histogram `json:"histogram,omitempty"` // Histogram. } // Do executes Browser.getHistogram against the provided context. // // returns: // // histogram - Histogram. func ( *GetHistogramParams) ( context.Context) ( *Histogram, error) { // execute var GetHistogramReturns = cdp.Execute(, CommandGetHistogram, , &) if != nil { return nil, } return .Histogram, nil } // GetWindowBoundsParams get position and size of the browser window. type GetWindowBoundsParams struct { 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. type GetWindowBoundsReturns struct { 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) { // execute var GetWindowBoundsReturns = cdp.Execute(, CommandGetWindowBounds, , &) if != nil { return nil, } return .Bounds, nil } // GetWindowForTargetParams get the browser window that contains the devtools // target. type GetWindowForTargetParams struct { 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. type GetWindowForTargetReturns struct { 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) { // execute var GetWindowForTargetReturns = cdp.Execute(, CommandGetWindowForTarget, , &) if != nil { return 0, nil, } return .WindowID, .Bounds, nil } // SetWindowBoundsParams set position and/or size of the browser window. type SetWindowBoundsParams struct { 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) { return cdp.Execute(, CommandSetWindowBounds, , nil) } // SetDockTileParams set dock tile details, platform-specific. type SetDockTileParams struct { 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) { return cdp.Execute(, CommandSetDockTile, , nil) } // ExecuteBrowserCommandParams invoke custom browser commands used by // telemetry. type ExecuteBrowserCommandParams struct { CommandID CommandID `json:"commandId"` } // ExecuteBrowserCommand invoke custom browser commands used by telemetry. // // See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-executeBrowserCommand // // parameters: // // commandID func ( CommandID) *ExecuteBrowserCommandParams { return &ExecuteBrowserCommandParams{ CommandID: , } } // Do executes Browser.executeBrowserCommand against the provided context. func ( *ExecuteBrowserCommandParams) ( context.Context) ( error) { return cdp.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. type AddPrivacySandboxEnrollmentOverrideParams struct { 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: // // url func ( string) *AddPrivacySandboxEnrollmentOverrideParams { return &AddPrivacySandboxEnrollmentOverrideParams{ URL: , } } // Do executes Browser.addPrivacySandboxEnrollmentOverride against the provided context. func ( *AddPrivacySandboxEnrollmentOverrideParams) ( context.Context) ( error) { return cdp.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" )