browser

package
v0.0.0-...-686a5c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 5 Imported by: 109

Documentation

Overview

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.

Index

Constants

View Source
const (
	CommandSetPermission                       = "Browser.setPermission"
	CommandResetPermissions                    = "Browser.resetPermissions"
	CommandSetDownloadBehavior                 = "Browser.setDownloadBehavior"
	CommandCancelDownload                      = "Browser.cancelDownload"
	CommandClose                               = "Browser.close"
	CommandCrash                               = "Browser.crash"
	CommandCrashGPUProcess                     = "Browser.crashGpuProcess"
	CommandGetVersion                          = "Browser.getVersion"
	CommandGetBrowserCommandLine               = "Browser.getBrowserCommandLine"
	CommandAddMockCamera                       = "Browser.addMockCamera"
	CommandGetHistograms                       = "Browser.getHistograms"
	CommandGetHistogram                        = "Browser.getHistogram"
	CommandGetWindowBounds                     = "Browser.getWindowBounds"
	CommandGetWindowForTarget                  = "Browser.getWindowForTarget"
	CommandSetWindowBounds                     = "Browser.setWindowBounds"
	CommandSetContentsSize                     = "Browser.setContentsSize"
	CommandSetDockTile                         = "Browser.setDockTile"
	CommandExecuteBrowserCommand               = "Browser.executeBrowserCommand"
	CommandAddPrivacySandboxEnrollmentOverride = "Browser.addPrivacySandboxEnrollmentOverride"
	CommandGetGlobalPrivacyControl             = "Browser.getGlobalPrivacyControl"
	CommandSetGlobalPrivacyControl             = "Browser.setGlobalPrivacyControl"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddMockCameraParams

type AddMockCameraParams struct {
	DeviceID string `json:"deviceId"` // Required non-empty identifier for the mock camera. This is mapped to an internal virtual-device identifier and is not the MediaDeviceInfo.deviceId exposed to the page.
}

AddMockCameraParams adds or updates a mock camera in the shared video capture device list for test automation. The mock camera is not scoped to a particular page or frame and is removed when the DevTools session that created it disconnects.

func AddMockCamera

func AddMockCamera(deviceID string) *AddMockCameraParams

AddMockCamera adds or updates a mock camera in the shared video capture device list for test automation. The mock camera is not scoped to a particular page or frame and is removed when the DevTools session that created it disconnects.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-addMockCamera

parameters:

deviceID - Required non-empty identifier for the mock camera. This is mapped to an internal virtual-device identifier and is not the MediaDeviceInfo.deviceId exposed to the page.

func (*AddMockCameraParams) Do

func (p *AddMockCameraParams) Do(ctx context.Context) (err error)

Do executes Browser.addMockCamera against the provided context.

type AddPrivacySandboxEnrollmentOverrideParams

type AddPrivacySandboxEnrollmentOverrideParams struct {
	URL string `json:"url"`
}

AddPrivacySandboxEnrollmentOverrideParams allows a site to use privacy sandbox features that require enrollment without the site actually being enrolled. Only supported on page targets.

func AddPrivacySandboxEnrollmentOverride

func AddPrivacySandboxEnrollmentOverride(url string) *AddPrivacySandboxEnrollmentOverrideParams

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 (*AddPrivacySandboxEnrollmentOverrideParams) Do

Do executes Browser.addPrivacySandboxEnrollmentOverride against the provided context.

type Bounds

type Bounds struct {
	Left        int64       `json:"left,omitempty,omitzero"`        // The offset from the left edge of the screen to the window in pixels.
	Top         int64       `json:"top,omitempty,omitzero"`         // The offset from the top edge of the screen to the window in pixels.
	Width       int64       `json:"width,omitempty,omitzero"`       // The window width in pixels.
	Height      int64       `json:"height,omitempty,omitzero"`      // The window height in pixels.
	WindowState WindowState `json:"windowState,omitempty,omitzero"` // The window state. Default to normal.
}

Bounds browser window bounds information.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-Bounds

type Bucket

type Bucket struct {
	Low   int64 `json:"low"`   // Minimum value (inclusive).
	High  int64 `json:"high"`  // Maximum value (exclusive).
	Count int64 `json:"count"` // Number of samples.
}

Bucket chrome histogram bucket.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-Bucket

type CancelDownloadParams

type CancelDownloadParams struct {
	GUID             string               `json:"guid"`                                // Global unique identifier of the download.
	BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty,omitzero"` // BrowserContext to perform the action in. When omitted, default browser context is used.
}

CancelDownloadParams cancel a download if in progress.

func CancelDownload

func CancelDownload(guid string) *CancelDownloadParams

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 (*CancelDownloadParams) Do

func (p *CancelDownloadParams) Do(ctx context.Context) (err error)

Do executes Browser.cancelDownload against the provided context.

func (CancelDownloadParams) WithBrowserContextID

func (p CancelDownloadParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *CancelDownloadParams

WithBrowserContextID browserContext to perform the action in. When omitted, default browser context is used.

type CloseParams

type CloseParams struct{}

CloseParams close browser gracefully.

func (*CloseParams) Do

func (p *CloseParams) Do(ctx context.Context) (err error)

Do executes Browser.close against the provided context.

type CommandID

type CommandID string

CommandID browser command ids used by executeBrowserCommand.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-BrowserCommandId

const (
	CommandIDOpenTabSearch  CommandID = "openTabSearch"
	CommandIDCloseTabSearch CommandID = "closeTabSearch"
	CommandIDOpenGlic       CommandID = "openGlic"
)

CommandID values.

func (CommandID) String

func (t CommandID) String() string

String returns the CommandID as string value.

func (*CommandID) UnmarshalJSON

func (t *CommandID) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies [json.Unmarshaler].

type CrashGPUProcessParams

type CrashGPUProcessParams struct{}

CrashGPUProcessParams crashes GPU process.

func (*CrashGPUProcessParams) Do

func (p *CrashGPUProcessParams) Do(ctx context.Context) (err error)

Do executes Browser.crashGpuProcess against the provided context.

type CrashParams

type CrashParams struct{}

CrashParams crashes browser on the main thread.

func Crash

func Crash() *CrashParams

Crash crashes browser on the main thread.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-crash

func (*CrashParams) Do

func (p *CrashParams) Do(ctx context.Context) (err error)

Do executes Browser.crash against the provided context.

type DownloadProgressState

type DownloadProgressState string

DownloadProgressState download status.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#event-downloadProgress

const (
	DownloadProgressStateInProgress DownloadProgressState = "inProgress"
	DownloadProgressStateCompleted  DownloadProgressState = "completed"
	DownloadProgressStateCanceled   DownloadProgressState = "canceled"
)

DownloadProgressState values.

func (DownloadProgressState) String

func (t DownloadProgressState) String() string

String returns the DownloadProgressState as string value.

func (*DownloadProgressState) UnmarshalJSON

func (t *DownloadProgressState) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies [json.Unmarshaler].

type EventDownloadProgress

type EventDownloadProgress struct {
	GUID          string                `json:"guid"`                        // Global unique identifier of the download.
	TotalBytes    float64               `json:"totalBytes"`                  // Total expected bytes to download.
	ReceivedBytes float64               `json:"receivedBytes"`               // Total bytes received.
	State         DownloadProgressState `json:"state"`                       // Download status.
	FilePath      string                `json:"filePath,omitempty,omitzero"` // If download is "completed", provides the path of the downloaded file. Depending on the platform, it is not guaranteed to be set, nor the file is guaranteed to exist.
}

EventDownloadProgress fired when download makes progress. Last call has |done| == true.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#event-downloadProgress

type EventDownloadWillBegin

type EventDownloadWillBegin struct {
	FrameID           cdp.FrameID `json:"frameId"`           // Id of the frame that caused the download to begin.
	GUID              string      `json:"guid"`              // Global unique identifier of the download.
	URL               string      `json:"url"`               // URL of the resource being downloaded.
	SuggestedFilename string      `json:"suggestedFilename"` // Suggested file name of the resource (the actual name of the file saved on disk may differ).
}

EventDownloadWillBegin fired when page is about to start a download.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#event-downloadWillBegin

type ExecuteBrowserCommandParams

type ExecuteBrowserCommandParams struct {
	CommandID CommandID `json:"commandId"`
}

ExecuteBrowserCommandParams invoke custom browser commands used by telemetry.

func ExecuteBrowserCommand

func ExecuteBrowserCommand(commandID CommandID) *ExecuteBrowserCommandParams

ExecuteBrowserCommand invoke custom browser commands used by telemetry.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-executeBrowserCommand

parameters:

commandID

func (*ExecuteBrowserCommandParams) Do

Do executes Browser.executeBrowserCommand against the provided context.

type GetBrowserCommandLineParams

type GetBrowserCommandLineParams struct{}

GetBrowserCommandLineParams returns the command line switches for the browser process if, and only if --enable-automation is on the commandline.

func GetBrowserCommandLine

func GetBrowserCommandLine() *GetBrowserCommandLineParams

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) Do

func (p *GetBrowserCommandLineParams) Do(ctx context.Context) (arguments []string, err error)

Do executes Browser.getBrowserCommandLine against the provided context.

returns:

arguments - Commandline parameters

type GetBrowserCommandLineReturns

type GetBrowserCommandLineReturns struct {
	Arguments []string `json:"arguments,omitempty,omitzero"` // Commandline parameters
}

GetBrowserCommandLineReturns return values.

type GetGlobalPrivacyControlParams

type GetGlobalPrivacyControlParams struct{}

GetGlobalPrivacyControlParams gets the current globally-applied privacy control status See https://www.w3.org/TR/gpc/#get-global-privacy-control.

func GetGlobalPrivacyControl

func GetGlobalPrivacyControl() *GetGlobalPrivacyControlParams

GetGlobalPrivacyControl gets the current globally-applied privacy control status See https://www.w3.org/TR/gpc/#get-global-privacy-control.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getGlobalPrivacyControl

func (*GetGlobalPrivacyControlParams) Do

func (p *GetGlobalPrivacyControlParams) Do(ctx context.Context) (gpc bool, err error)

Do executes Browser.getGlobalPrivacyControl against the provided context.

returns:

gpc

type GetGlobalPrivacyControlReturns

type GetGlobalPrivacyControlReturns struct {
	Gpc bool `json:"gpc"`
}

GetGlobalPrivacyControlReturns return values.

type GetHistogramParams

type GetHistogramParams struct {
	Name  string `json:"name"`  // Requested histogram name.
	Delta bool   `json:"delta"` // If true, retrieve delta since last delta call.
}

GetHistogramParams get a Chrome histogram by name.

func GetHistogram

func GetHistogram(name string) *GetHistogramParams

GetHistogram get a Chrome histogram by name.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getHistogram

parameters:

name - Requested histogram name.

func (*GetHistogramParams) Do

func (p *GetHistogramParams) Do(ctx context.Context) (histogram *Histogram, err error)

Do executes Browser.getHistogram against the provided context.

returns:

histogram - Histogram.

func (GetHistogramParams) WithDelta

func (p GetHistogramParams) WithDelta(delta bool) *GetHistogramParams

WithDelta if true, retrieve delta since last delta call.

type GetHistogramReturns

type GetHistogramReturns struct {
	Histogram *Histogram `json:"histogram,omitempty,omitzero"` // Histogram.
}

GetHistogramReturns return values.

type GetHistogramsParams

type GetHistogramsParams struct {
	Query string `json:"query,omitempty,omitzero"` // 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"`                    // If true, retrieve delta since last delta call.
}

GetHistogramsParams get Chrome histograms.

func GetHistograms

func GetHistograms() *GetHistogramsParams

GetHistograms get Chrome histograms.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getHistograms

parameters:

func (*GetHistogramsParams) Do

func (p *GetHistogramsParams) Do(ctx context.Context) (histograms []*Histogram, err error)

Do executes Browser.getHistograms against the provided context.

returns:

histograms - Histograms.

func (GetHistogramsParams) WithDelta

func (p GetHistogramsParams) WithDelta(delta bool) *GetHistogramsParams

WithDelta if true, retrieve delta since last delta call.

func (GetHistogramsParams) WithQuery

func (p GetHistogramsParams) WithQuery(query string) *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.

type GetHistogramsReturns

type GetHistogramsReturns struct {
	Histograms []*Histogram `json:"histograms,omitempty,omitzero"` // Histograms.
}

GetHistogramsReturns return values.

type GetVersionParams

type GetVersionParams struct{}

GetVersionParams returns version information.

func GetVersion

func GetVersion() *GetVersionParams

GetVersion returns version information.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getVersion

func (*GetVersionParams) Do

func (p *GetVersionParams) Do(ctx context.Context) (protocolVersion string, product string, revision string, userAgent string, jsVersion string, err error)

Do executes Browser.getVersion against the provided context.

returns:

protocolVersion - Protocol version.
product - Product name.
revision - Product revision.
userAgent - User-Agent.
jsVersion - V8 version.

type GetVersionReturns

type GetVersionReturns struct {
	ProtocolVersion string `json:"protocolVersion,omitempty,omitzero"` // Protocol version.
	Product         string `json:"product,omitempty,omitzero"`         // Product name.
	Revision        string `json:"revision,omitempty,omitzero"`        // Product revision.
	UserAgent       string `json:"userAgent,omitempty,omitzero"`       // User-Agent.
	JsVersion       string `json:"jsVersion,omitempty,omitzero"`       // V8 version.
}

GetVersionReturns return values.

type GetWindowBoundsParams

type GetWindowBoundsParams struct {
	WindowID WindowID `json:"windowId"` // Browser window id.
}

GetWindowBoundsParams get position and size of the browser window.

func GetWindowBounds

func GetWindowBounds(windowID WindowID) *GetWindowBoundsParams

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 (*GetWindowBoundsParams) Do

func (p *GetWindowBoundsParams) Do(ctx context.Context) (bounds *Bounds, err error)

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.

type GetWindowBoundsReturns

type GetWindowBoundsReturns struct {
	Bounds *Bounds `json:"bounds,omitempty,omitzero"` // Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
}

GetWindowBoundsReturns return values.

type GetWindowForTargetParams

type GetWindowForTargetParams struct {
	TargetID target.ID `json:"targetId,omitempty,omitzero"` // Devtools agent host id. If called as a part of the session, associated targetId is used.
}

GetWindowForTargetParams get the browser window that contains the devtools target.

func GetWindowForTarget

func GetWindowForTarget() *GetWindowForTargetParams

GetWindowForTarget get the browser window that contains the devtools target.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-getWindowForTarget

parameters:

func (*GetWindowForTargetParams) Do

func (p *GetWindowForTargetParams) Do(ctx context.Context) (windowID WindowID, bounds *Bounds, err error)

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) WithTargetID

func (p GetWindowForTargetParams) WithTargetID(targetID target.ID) *GetWindowForTargetParams

WithTargetID devtools agent host id. If called as a part of the session, associated targetId is used.

type GetWindowForTargetReturns

type GetWindowForTargetReturns struct {
	WindowID WindowID `json:"windowId,omitempty,omitzero"` // Browser window id.
	Bounds   *Bounds  `json:"bounds,omitempty,omitzero"`   // Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
}

GetWindowForTargetReturns return values.

type Histogram

type Histogram struct {
	Name    string    `json:"name"`    // Name.
	Sum     int64     `json:"sum"`     // Sum of sample values.
	Count   int64     `json:"count"`   // Total number of samples.
	Buckets []*Bucket `json:"buckets"` // Buckets.
}

Histogram chrome histogram.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-Histogram

type PermissionDescriptor

type PermissionDescriptor struct {
	Name                     string `json:"name"`                     // Name of permission. See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names.
	Sysex                    bool   `json:"sysex"`                    // For "midi" permission, may also specify sysex control.
	UserVisibleOnly          bool   `json:"userVisibleOnly"`          // For "push" permission, may specify userVisibleOnly. Note that userVisibleOnly = true is the only currently supported type.
	AllowWithoutSanitization bool   `json:"allowWithoutSanitization"` // For "clipboard" permission, may specify allowWithoutSanitization.
	AllowWithoutGesture      bool   `json:"allowWithoutGesture"`      // For "fullscreen" permission, must specify allowWithoutGesture:true.
	PanTiltZoom              bool   `json:"panTiltZoom"`              // For "camera" permission, may specify panTiltZoom.
}

PermissionDescriptor definition of PermissionDescriptor defined in the Permissions API: https://w3c.github.io/permissions/#dom-permissiondescriptor.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-PermissionDescriptor

type PermissionSetting

type PermissionSetting string

PermissionSetting [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-PermissionSetting

const (
	PermissionSettingGranted PermissionSetting = "granted"
	PermissionSettingDenied  PermissionSetting = "denied"
	PermissionSettingPrompt  PermissionSetting = "prompt"
)

PermissionSetting values.

func (PermissionSetting) String

func (t PermissionSetting) String() string

String returns the PermissionSetting as string value.

func (*PermissionSetting) UnmarshalJSON

func (t *PermissionSetting) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies [json.Unmarshaler].

type PermissionType

type PermissionType string

PermissionType [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-PermissionType

const (
	PermissionTypeAr                       PermissionType = "ar"
	PermissionTypeAudioCapture             PermissionType = "audioCapture"
	PermissionTypeAutomaticFullscreen      PermissionType = "automaticFullscreen"
	PermissionTypeBackgroundFetch          PermissionType = "backgroundFetch"
	PermissionTypeBackgroundSync           PermissionType = "backgroundSync"
	PermissionTypeCameraPanTiltZoom        PermissionType = "cameraPanTiltZoom"
	PermissionTypeCapturedSurfaceControl   PermissionType = "capturedSurfaceControl"
	PermissionTypeClipboardReadWrite       PermissionType = "clipboardReadWrite"
	PermissionTypeClipboardSanitizedWrite  PermissionType = "clipboardSanitizedWrite"
	PermissionTypeDisplayCapture           PermissionType = "displayCapture"
	PermissionTypeDurableStorage           PermissionType = "durableStorage"
	PermissionTypeGeolocation              PermissionType = "geolocation"
	PermissionTypeHandTracking             PermissionType = "handTracking"
	PermissionTypeIdleDetection            PermissionType = "idleDetection"
	PermissionTypeKeyboardLock             PermissionType = "keyboardLock"
	PermissionTypeLocalFonts               PermissionType = "localFonts"
	PermissionTypeLocalNetwork             PermissionType = "localNetwork"
	PermissionTypeLocalNetworkAccess       PermissionType = "localNetworkAccess"
	PermissionTypeLoopbackNetwork          PermissionType = "loopbackNetwork"
	PermissionTypeMidi                     PermissionType = "midi"
	PermissionTypeMidiSysex                PermissionType = "midiSysex"
	PermissionTypeNfc                      PermissionType = "nfc"
	PermissionTypeNotifications            PermissionType = "notifications"
	PermissionTypePaymentHandler           PermissionType = "paymentHandler"
	PermissionTypePeriodicBackgroundSync   PermissionType = "periodicBackgroundSync"
	PermissionTypePointerLock              PermissionType = "pointerLock"
	PermissionTypeProtectedMediaIdentifier PermissionType = "protectedMediaIdentifier"
	PermissionTypeSensors                  PermissionType = "sensors"
	PermissionTypeSmartCard                PermissionType = "smartCard"
	PermissionTypeSpeakerSelection         PermissionType = "speakerSelection"
	PermissionTypeStorageAccess            PermissionType = "storageAccess"
	PermissionTypeTopLevelStorageAccess    PermissionType = "topLevelStorageAccess"
	PermissionTypeVideoCapture             PermissionType = "videoCapture"
	PermissionTypeVr                       PermissionType = "vr"
	PermissionTypeWakeLockScreen           PermissionType = "wakeLockScreen"
	PermissionTypeWakeLockSystem           PermissionType = "wakeLockSystem"
	PermissionTypeWebAppInstallation       PermissionType = "webAppInstallation"
	PermissionTypeWebPrinting              PermissionType = "webPrinting"
	PermissionTypeWindowManagement         PermissionType = "windowManagement"
)

PermissionType values.

func (PermissionType) String

func (t PermissionType) String() string

String returns the PermissionType as string value.

func (*PermissionType) UnmarshalJSON

func (t *PermissionType) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies [json.Unmarshaler].

type ResetPermissionsParams

type ResetPermissionsParams struct {
	BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty,omitzero"` // BrowserContext to reset permissions. When omitted, default browser context is used.
}

ResetPermissionsParams reset all permission management for all origins.

func ResetPermissions

func ResetPermissions() *ResetPermissionsParams

ResetPermissions reset all permission management for all origins.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-resetPermissions

parameters:

func (*ResetPermissionsParams) Do

func (p *ResetPermissionsParams) Do(ctx context.Context) (err error)

Do executes Browser.resetPermissions against the provided context.

func (ResetPermissionsParams) WithBrowserContextID

func (p ResetPermissionsParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *ResetPermissionsParams

WithBrowserContextID browserContext to reset permissions. When omitted, default browser context is used.

type SetContentsSizeParams

type SetContentsSizeParams struct {
	WindowID WindowID `json:"windowId"`                  // Browser window id.
	Width    int64    `json:"width,omitempty,omitzero"`  // The window contents width in DIP. Assumes current width if omitted. Must be specified if 'height' is omitted.
	Height   int64    `json:"height,omitempty,omitzero"` // The window contents height in DIP. Assumes current height if omitted. Must be specified if 'width' is omitted.
}

SetContentsSizeParams set size of the browser contents resizing browser window as necessary.

func SetContentsSize

func SetContentsSize(windowID WindowID) *SetContentsSizeParams

SetContentsSize set size of the browser contents resizing browser window as necessary.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setContentsSize

parameters:

windowID - Browser window id.

func (*SetContentsSizeParams) Do

func (p *SetContentsSizeParams) Do(ctx context.Context) (err error)

Do executes Browser.setContentsSize against the provided context.

func (SetContentsSizeParams) WithHeight

func (p SetContentsSizeParams) WithHeight(height int64) *SetContentsSizeParams

WithHeight the window contents height in DIP. Assumes current height if omitted. Must be specified if 'width' is omitted.

func (SetContentsSizeParams) WithWidth

WithWidth the window contents width in DIP. Assumes current width if omitted. Must be specified if 'height' is omitted.

type SetDockTileParams

type SetDockTileParams struct {
	BadgeLabel string `json:"badgeLabel,omitempty,omitzero"`
	Image      string `json:"image,omitempty,omitzero"` // Png encoded image.
}

SetDockTileParams set dock tile details, platform-specific.

func SetDockTile

func SetDockTile() *SetDockTileParams

SetDockTile set dock tile details, platform-specific.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setDockTile

parameters:

func (*SetDockTileParams) Do

func (p *SetDockTileParams) Do(ctx context.Context) (err error)

Do executes Browser.setDockTile against the provided context.

func (SetDockTileParams) WithBadgeLabel

func (p SetDockTileParams) WithBadgeLabel(badgeLabel string) *SetDockTileParams

WithBadgeLabel [no description].

func (SetDockTileParams) WithImage

func (p SetDockTileParams) WithImage(image string) *SetDockTileParams

WithImage png encoded image.

type SetDownloadBehaviorBehavior

type SetDownloadBehaviorBehavior string

SetDownloadBehaviorBehavior 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 download guids.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setDownloadBehavior

const (
	SetDownloadBehaviorBehaviorDeny         SetDownloadBehaviorBehavior = "deny"
	SetDownloadBehaviorBehaviorAllow        SetDownloadBehaviorBehavior = "allow"
	SetDownloadBehaviorBehaviorAllowAndName SetDownloadBehaviorBehavior = "allowAndName"
	SetDownloadBehaviorBehaviorDefault      SetDownloadBehaviorBehavior = "default"
)

SetDownloadBehaviorBehavior values.

func (SetDownloadBehaviorBehavior) String

String returns the SetDownloadBehaviorBehavior as string value.

func (*SetDownloadBehaviorBehavior) UnmarshalJSON

func (t *SetDownloadBehaviorBehavior) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies [json.Unmarshaler].

type SetDownloadBehaviorParams

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 download guids.
	BrowserContextID cdp.BrowserContextID        `json:"browserContextId,omitempty,omitzero"` // BrowserContext to set download behavior. When omitted, default browser context is used.
	DownloadPath     string                      `json:"downloadPath,omitempty,omitzero"`     // The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'.
	EventsEnabled    bool                        `json:"eventsEnabled"`                       // Whether to emit download events (defaults to false).
}

SetDownloadBehaviorParams set the behavior when downloading a file.

func SetDownloadBehavior

func SetDownloadBehavior(behavior SetDownloadBehaviorBehavior) *SetDownloadBehaviorParams

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 download guids.

func (*SetDownloadBehaviorParams) Do

Do executes Browser.setDownloadBehavior against the provided context.

func (SetDownloadBehaviorParams) WithBrowserContextID

func (p SetDownloadBehaviorParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *SetDownloadBehaviorParams

WithBrowserContextID browserContext to set download behavior. When omitted, default browser context is used.

func (SetDownloadBehaviorParams) WithDownloadPath

func (p SetDownloadBehaviorParams) WithDownloadPath(downloadPath string) *SetDownloadBehaviorParams

WithDownloadPath the default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'.

func (SetDownloadBehaviorParams) WithEventsEnabled

func (p SetDownloadBehaviorParams) WithEventsEnabled(eventsEnabled bool) *SetDownloadBehaviorParams

WithEventsEnabled whether to emit download events (defaults to false).

type SetGlobalPrivacyControlParams

type SetGlobalPrivacyControlParams struct {
	Gpc bool `json:"gpc"`
}

SetGlobalPrivacyControlParams sets and then gets the current globally-applied privacy control status See https://www.w3.org/TR/gpc/#set-global-privacy-control.

func SetGlobalPrivacyControl

func SetGlobalPrivacyControl(gpc bool) *SetGlobalPrivacyControlParams

SetGlobalPrivacyControl sets and then gets the current globally-applied privacy control status See https://www.w3.org/TR/gpc/#set-global-privacy-control.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setGlobalPrivacyControl

parameters:

gpc

func (*SetGlobalPrivacyControlParams) Do

func (p *SetGlobalPrivacyControlParams) Do(ctx context.Context) (gpc bool, err error)

Do executes Browser.setGlobalPrivacyControl against the provided context.

returns:

gpc

type SetGlobalPrivacyControlReturns

type SetGlobalPrivacyControlReturns struct {
	Gpc bool `json:"gpc"`
}

SetGlobalPrivacyControlReturns return values.

type SetPermissionParams

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,omitzero"`           // Embedding origin the permission applies to, all origins if not specified.
	EmbeddedOrigin   string                `json:"embeddedOrigin,omitempty,omitzero"`   // Embedded origin the permission applies to. It is ignored unless the embedding origin is present and valid. If the embedding origin is provided but the embedded origin isn't, the embedding origin is used as the embedded origin.
	BrowserContextID cdp.BrowserContextID  `json:"browserContextId,omitempty,omitzero"` // Context to override. When omitted, default browser context is used.
}

SetPermissionParams set permission settings for given embedding and embedded origins.

func SetPermission

func SetPermission(permission *PermissionDescriptor, setting PermissionSetting) *SetPermissionParams

SetPermission set permission settings for given embedding and embedded origins.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#method-setPermission

parameters:

permission - Descriptor of permission to override.
setting - Setting of the permission.

func (*SetPermissionParams) Do

func (p *SetPermissionParams) Do(ctx context.Context) (err error)

Do executes Browser.setPermission against the provided context.

func (SetPermissionParams) WithBrowserContextID

func (p SetPermissionParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *SetPermissionParams

WithBrowserContextID context to override. When omitted, default browser context is used.

func (SetPermissionParams) WithEmbeddedOrigin

func (p SetPermissionParams) WithEmbeddedOrigin(embeddedOrigin string) *SetPermissionParams

WithEmbeddedOrigin embedded origin the permission applies to. It is ignored unless the embedding origin is present and valid. If the embedding origin is provided but the embedded origin isn't, the embedding origin is used as the embedded origin.

func (SetPermissionParams) WithOrigin

func (p SetPermissionParams) WithOrigin(origin string) *SetPermissionParams

WithOrigin embedding origin the permission applies to, all origins if not specified.

type SetWindowBoundsParams

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.
}

SetWindowBoundsParams set position and/or size of the browser window.

func SetWindowBounds

func SetWindowBounds(windowID WindowID, bounds *Bounds) *SetWindowBoundsParams

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 (*SetWindowBoundsParams) Do

func (p *SetWindowBoundsParams) Do(ctx context.Context) (err error)

Do executes Browser.setWindowBounds against the provided context.

type WindowID

type WindowID int64

WindowID [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-WindowID

func (WindowID) Int64

func (t WindowID) Int64() int64

Int64 returns the WindowID as int64 value.

type WindowState

type WindowState string

WindowState the state of the browser window.

See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-WindowState

const (
	WindowStateNormal     WindowState = "normal"
	WindowStateMinimized  WindowState = "minimized"
	WindowStateMaximized  WindowState = "maximized"
	WindowStateFullscreen WindowState = "fullscreen"
)

WindowState values.

func (WindowState) String

func (t WindowState) String() string

String returns the WindowState as string value.

func (*WindowState) UnmarshalJSON

func (t *WindowState) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies [json.Unmarshaler].

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL