Documentation
¶
Overview ¶
Package emulation provides the Chrome DevTools Protocol commands, types, and events for the Emulation domain.
This domain emulates different environments for the page.
Generated by the cdproto-gen command.
Index ¶
- Constants
- type AddScreenParams
- func (p *AddScreenParams) Do(ctx context.Context) (screenInfo *ScreenInfo, err error)
- func (p AddScreenParams) WithColorDepth(colorDepth int64) *AddScreenParams
- func (p AddScreenParams) WithDevicePixelRatio(devicePixelRatio float64) *AddScreenParams
- func (p AddScreenParams) WithIsInternal(isInternal bool) *AddScreenParams
- func (p AddScreenParams) WithLabel(label string) *AddScreenParams
- func (p AddScreenParams) WithRotation(rotation int64) *AddScreenParams
- func (p AddScreenParams) WithWorkAreaInsets(workAreaInsets *WorkAreaInsets) *AddScreenParams
- type AddScreenReturns
- type ClearDeviceMetricsOverrideParams
- type ClearDevicePostureOverrideParams
- type ClearDisplayFeaturesOverrideParams
- type ClearGeolocationOverrideParams
- type ClearIdleOverrideParams
- type DevicePosture
- type DevicePostureType
- type DisabledImageType
- type DisplayFeature
- type DisplayFeatureOrientation
- type EventScreenOrientationLockChanged
- type EventVirtualTimeBudgetExpired
- type GetOverriddenSensorInformationParams
- type GetOverriddenSensorInformationReturns
- type GetScreenInfosParams
- type GetScreenInfosReturns
- type MediaFeature
- type OrientationType
- type PressureMetadata
- type PressureSource
- type PressureState
- type RemoveScreenParams
- type ResetPageScaleFactorParams
- type SafeAreaInsets
- type ScreenID
- type ScreenInfo
- type ScreenOrientation
- type SensorMetadata
- type SensorReading
- type SensorReadingQuaternion
- type SensorReadingSingle
- type SensorReadingXYZ
- type SensorType
- type SetAutoDarkModeOverrideParams
- type SetAutomationOverrideParams
- type SetCPUThrottlingRateParams
- type SetDataSaverOverrideParams
- type SetDefaultBackgroundColorOverrideParams
- type SetDeviceMetricsOverrideParams
- func (p *SetDeviceMetricsOverrideParams) Do(ctx context.Context) (err error)
- func (p SetDeviceMetricsOverrideParams) WithDontSetVisibleSize(dontSetVisibleSize bool) *SetDeviceMetricsOverrideParams
- func (p SetDeviceMetricsOverrideParams) WithPositionX(positionX int64) *SetDeviceMetricsOverrideParams
- func (p SetDeviceMetricsOverrideParams) WithPositionY(positionY int64) *SetDeviceMetricsOverrideParams
- func (p SetDeviceMetricsOverrideParams) WithScale(scale float64) *SetDeviceMetricsOverrideParams
- func (p SetDeviceMetricsOverrideParams) WithScreenHeight(screenHeight int64) *SetDeviceMetricsOverrideParams
- func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation *ScreenOrientation) *SetDeviceMetricsOverrideParams
- func (p SetDeviceMetricsOverrideParams) WithScreenOrientationLockEmulation(screenOrientationLockEmulation bool) *SetDeviceMetricsOverrideParams
- func (p SetDeviceMetricsOverrideParams) WithScreenWidth(screenWidth int64) *SetDeviceMetricsOverrideParams
- func (p SetDeviceMetricsOverrideParams) WithScrollbarType(scrollbarType SetDeviceMetricsOverrideScrollbarType) *SetDeviceMetricsOverrideParams
- func (p SetDeviceMetricsOverrideParams) WithViewport(viewport *page.Viewport) *SetDeviceMetricsOverrideParams
- type SetDeviceMetricsOverrideScrollbarType
- type SetDevicePostureOverrideParams
- type SetDisabledImageTypesParams
- type SetDisplayFeaturesOverrideParams
- type SetDocumentCookieDisabledParams
- type SetEmitTouchEventsForMouseConfiguration
- type SetEmitTouchEventsForMouseParams
- type SetEmulatedMediaParams
- type SetEmulatedOSTextScaleParams
- type SetEmulatedVisionDeficiencyParams
- type SetEmulatedVisionDeficiencyType
- type SetFocusEmulationEnabledParams
- type SetGeolocationOverrideParams
- func (p *SetGeolocationOverrideParams) Do(ctx context.Context) (err error)
- func (p SetGeolocationOverrideParams) WithAccuracy(accuracy float64) *SetGeolocationOverrideParams
- func (p SetGeolocationOverrideParams) WithAltitude(altitude float64) *SetGeolocationOverrideParams
- func (p SetGeolocationOverrideParams) WithAltitudeAccuracy(altitudeAccuracy float64) *SetGeolocationOverrideParams
- func (p SetGeolocationOverrideParams) WithHeading(heading float64) *SetGeolocationOverrideParams
- func (p SetGeolocationOverrideParams) WithLatitude(latitude float64) *SetGeolocationOverrideParams
- func (p SetGeolocationOverrideParams) WithLongitude(longitude float64) *SetGeolocationOverrideParams
- func (p SetGeolocationOverrideParams) WithSpeed(speed float64) *SetGeolocationOverrideParams
- type SetHardwareConcurrencyOverrideParams
- type SetIdleOverrideParams
- type SetLocaleOverrideParams
- type SetPageScaleFactorParams
- type SetPressureDataOverrideParams
- type SetPressureSourceOverrideEnabledParams
- type SetPressureStateOverrideParams
- type SetPrimaryScreenParams
- type SetSafeAreaInsetsOverrideParams
- type SetScriptExecutionDisabledParams
- type SetScrollbarsHiddenParams
- type SetSensorOverrideEnabledParams
- type SetSensorOverrideReadingsParams
- type SetSmallViewportHeightDifferenceOverrideParams
- type SetTimezoneOverrideParams
- type SetTouchEmulationEnabledParams
- type SetUserAgentOverrideParams
- func (p *SetUserAgentOverrideParams) Do(ctx context.Context) (err error)
- func (p SetUserAgentOverrideParams) WithAcceptLanguage(acceptLanguage string) *SetUserAgentOverrideParams
- func (p SetUserAgentOverrideParams) WithPlatform(platform string) *SetUserAgentOverrideParams
- func (p SetUserAgentOverrideParams) WithUserAgentMetadata(userAgentMetadata *UserAgentMetadata) *SetUserAgentOverrideParams
- type SetVirtualTimePolicyParams
- func (p *SetVirtualTimePolicyParams) Do(ctx context.Context) (virtualTimeTicksBase float64, err error)
- func (p SetVirtualTimePolicyParams) WithBudget(budget float64) *SetVirtualTimePolicyParams
- func (p SetVirtualTimePolicyParams) WithInitialVirtualTime(initialVirtualTime *cdp.TimeSinceEpoch) *SetVirtualTimePolicyParams
- func (p SetVirtualTimePolicyParams) WithMaxVirtualTimeTaskStarvationCount(maxVirtualTimeTaskStarvationCount int64) *SetVirtualTimePolicyParams
- type SetVirtualTimePolicyReturns
- type UpdateScreenParams
- func (p *UpdateScreenParams) Do(ctx context.Context) (screenInfo *ScreenInfo, err error)
- func (p UpdateScreenParams) WithColorDepth(colorDepth int64) *UpdateScreenParams
- func (p UpdateScreenParams) WithDevicePixelRatio(devicePixelRatio float64) *UpdateScreenParams
- func (p UpdateScreenParams) WithHeight(height int64) *UpdateScreenParams
- func (p UpdateScreenParams) WithIsInternal(isInternal bool) *UpdateScreenParams
- func (p UpdateScreenParams) WithLabel(label string) *UpdateScreenParams
- func (p UpdateScreenParams) WithLeft(left int64) *UpdateScreenParams
- func (p UpdateScreenParams) WithRotation(rotation int64) *UpdateScreenParams
- func (p UpdateScreenParams) WithTop(top int64) *UpdateScreenParams
- func (p UpdateScreenParams) WithWidth(width int64) *UpdateScreenParams
- func (p UpdateScreenParams) WithWorkAreaInsets(workAreaInsets *WorkAreaInsets) *UpdateScreenParams
- type UpdateScreenReturns
- type UserAgentBrandVersion
- type UserAgentMetadata
- type VirtualTimePolicy
- type WorkAreaInsets
Constants ¶
const ( CommandClearDeviceMetricsOverride = "Emulation.clearDeviceMetricsOverride" CommandClearGeolocationOverride = "Emulation.clearGeolocationOverride" CommandResetPageScaleFactor = "Emulation.resetPageScaleFactor" CommandSetFocusEmulationEnabled = "Emulation.setFocusEmulationEnabled" CommandSetAutoDarkModeOverride = "Emulation.setAutoDarkModeOverride" CommandSetCPUThrottlingRate = "Emulation.setCPUThrottlingRate" CommandSetDefaultBackgroundColorOverride = "Emulation.setDefaultBackgroundColorOverride" CommandSetSafeAreaInsetsOverride = "Emulation.setSafeAreaInsetsOverride" CommandSetDeviceMetricsOverride = "Emulation.setDeviceMetricsOverride" CommandSetDevicePostureOverride = "Emulation.setDevicePostureOverride" CommandClearDevicePostureOverride = "Emulation.clearDevicePostureOverride" CommandSetDisplayFeaturesOverride = "Emulation.setDisplayFeaturesOverride" CommandClearDisplayFeaturesOverride = "Emulation.clearDisplayFeaturesOverride" CommandSetScrollbarsHidden = "Emulation.setScrollbarsHidden" CommandSetDocumentCookieDisabled = "Emulation.setDocumentCookieDisabled" CommandSetEmitTouchEventsForMouse = "Emulation.setEmitTouchEventsForMouse" CommandSetEmulatedMedia = "Emulation.setEmulatedMedia" CommandSetEmulatedVisionDeficiency = "Emulation.setEmulatedVisionDeficiency" CommandSetEmulatedOSTextScale = "Emulation.setEmulatedOSTextScale" CommandSetGeolocationOverride = "Emulation.setGeolocationOverride" CommandGetOverriddenSensorInformation = "Emulation.getOverriddenSensorInformation" CommandSetSensorOverrideEnabled = "Emulation.setSensorOverrideEnabled" CommandSetSensorOverrideReadings = "Emulation.setSensorOverrideReadings" CommandSetPressureSourceOverrideEnabled = "Emulation.setPressureSourceOverrideEnabled" CommandSetPressureStateOverride = "Emulation.setPressureStateOverride" CommandSetPressureDataOverride = "Emulation.setPressureDataOverride" CommandSetIdleOverride = "Emulation.setIdleOverride" CommandClearIdleOverride = "Emulation.clearIdleOverride" CommandSetPageScaleFactor = "Emulation.setPageScaleFactor" CommandSetScriptExecutionDisabled = "Emulation.setScriptExecutionDisabled" CommandSetTouchEmulationEnabled = "Emulation.setTouchEmulationEnabled" CommandSetVirtualTimePolicy = "Emulation.setVirtualTimePolicy" CommandSetLocaleOverride = "Emulation.setLocaleOverride" CommandSetTimezoneOverride = "Emulation.setTimezoneOverride" CommandSetDisabledImageTypes = "Emulation.setDisabledImageTypes" CommandSetDataSaverOverride = "Emulation.setDataSaverOverride" CommandSetHardwareConcurrencyOverride = "Emulation.setHardwareConcurrencyOverride" CommandSetUserAgentOverride = "Emulation.setUserAgentOverride" CommandSetAutomationOverride = "Emulation.setAutomationOverride" CommandSetSmallViewportHeightDifferenceOverride = "Emulation.setSmallViewportHeightDifferenceOverride" CommandGetScreenInfos = "Emulation.getScreenInfos" CommandAddScreen = "Emulation.addScreen" CommandUpdateScreen = "Emulation.updateScreen" CommandRemoveScreen = "Emulation.removeScreen" CommandSetPrimaryScreen = "Emulation.setPrimaryScreen" )
Command names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddScreenParams ¶
type AddScreenParams struct {
Left int64 `json:"left"` // Offset of the left edge of the screen in pixels.
Top int64 `json:"top"` // Offset of the top edge of the screen in pixels.
Width int64 `json:"width"` // The width of the screen in pixels.
Height int64 `json:"height"` // The height of the screen in pixels.
WorkAreaInsets *WorkAreaInsets `json:"workAreaInsets,omitempty,omitzero"` // Specifies the screen's work area. Default is entire screen.
DevicePixelRatio float64 `json:"devicePixelRatio,omitempty,omitzero"` // Specifies the screen's device pixel ratio. Default is 1.
Rotation int64 `json:"rotation,omitempty,omitzero"` // Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
ColorDepth int64 `json:"colorDepth,omitempty,omitzero"` // Specifies the screen's color depth in bits. Default is 24.
Label string `json:"label,omitempty,omitzero"` // Specifies the descriptive label for the screen. Default is none.
IsInternal bool `json:"isInternal"` // Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
}
AddScreenParams add a new screen to the device. Only supported in headless mode.
func AddScreen ¶
func AddScreen(left int64, top int64, width int64, height int64) *AddScreenParams
AddScreen add a new screen to the device. Only supported in headless mode.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-addScreen
parameters:
left - Offset of the left edge of the screen in pixels. top - Offset of the top edge of the screen in pixels. width - The width of the screen in pixels. height - The height of the screen in pixels.
func (*AddScreenParams) Do ¶
func (p *AddScreenParams) Do(ctx context.Context) (screenInfo *ScreenInfo, err error)
Do executes Emulation.addScreen against the provided context.
returns:
screenInfo
func (AddScreenParams) WithColorDepth ¶
func (p AddScreenParams) WithColorDepth(colorDepth int64) *AddScreenParams
WithColorDepth specifies the screen's color depth in bits. Default is 24.
func (AddScreenParams) WithDevicePixelRatio ¶
func (p AddScreenParams) WithDevicePixelRatio(devicePixelRatio float64) *AddScreenParams
WithDevicePixelRatio specifies the screen's device pixel ratio. Default is 1.
func (AddScreenParams) WithIsInternal ¶
func (p AddScreenParams) WithIsInternal(isInternal bool) *AddScreenParams
WithIsInternal indicates whether the screen is internal to the device or external, attached to the device. Default is false.
func (AddScreenParams) WithLabel ¶
func (p AddScreenParams) WithLabel(label string) *AddScreenParams
WithLabel specifies the descriptive label for the screen. Default is none.
func (AddScreenParams) WithRotation ¶
func (p AddScreenParams) WithRotation(rotation int64) *AddScreenParams
WithRotation specifies the screen's rotation angle. Available values are 0, 90, 180 and 270. Default is 0.
func (AddScreenParams) WithWorkAreaInsets ¶
func (p AddScreenParams) WithWorkAreaInsets(workAreaInsets *WorkAreaInsets) *AddScreenParams
WithWorkAreaInsets specifies the screen's work area. Default is entire screen.
type AddScreenReturns ¶
type AddScreenReturns struct {
ScreenInfo *ScreenInfo `json:"screenInfo,omitempty,omitzero"`
}
AddScreenReturns return values.
type ClearDeviceMetricsOverrideParams ¶
type ClearDeviceMetricsOverrideParams struct{}
ClearDeviceMetricsOverrideParams clears the overridden device metrics.
func ClearDeviceMetricsOverride ¶
func ClearDeviceMetricsOverride() *ClearDeviceMetricsOverrideParams
ClearDeviceMetricsOverride clears the overridden device metrics.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-clearDeviceMetricsOverride
type ClearDevicePostureOverrideParams ¶
type ClearDevicePostureOverrideParams struct{}
ClearDevicePostureOverrideParams clears a device posture override set with either setDeviceMetricsOverride() or setDevicePostureOverride() and starts using posture information from the platform again. Does nothing if no override is set.
func ClearDevicePostureOverride ¶
func ClearDevicePostureOverride() *ClearDevicePostureOverrideParams
ClearDevicePostureOverride clears a device posture override set with either setDeviceMetricsOverride() or setDevicePostureOverride() and starts using posture information from the platform again. Does nothing if no override is set.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-clearDevicePostureOverride
type ClearDisplayFeaturesOverrideParams ¶
type ClearDisplayFeaturesOverrideParams struct{}
ClearDisplayFeaturesOverrideParams clears the display features override set with either setDeviceMetricsOverride() or setDisplayFeaturesOverride() and starts using display features from the platform again. Does nothing if no override is set.
func ClearDisplayFeaturesOverride ¶
func ClearDisplayFeaturesOverride() *ClearDisplayFeaturesOverrideParams
ClearDisplayFeaturesOverride clears the display features override set with either setDeviceMetricsOverride() or setDisplayFeaturesOverride() and starts using display features from the platform again. Does nothing if no override is set.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-clearDisplayFeaturesOverride
type ClearGeolocationOverrideParams ¶
type ClearGeolocationOverrideParams struct{}
ClearGeolocationOverrideParams clears the overridden Geolocation Position and Error.
func ClearGeolocationOverride ¶
func ClearGeolocationOverride() *ClearGeolocationOverrideParams
ClearGeolocationOverride clears the overridden Geolocation Position and Error.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-clearGeolocationOverride
type ClearIdleOverrideParams ¶
type ClearIdleOverrideParams struct{}
ClearIdleOverrideParams clears Idle state overrides.
func ClearIdleOverride ¶
func ClearIdleOverride() *ClearIdleOverrideParams
ClearIdleOverride clears Idle state overrides.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-clearIdleOverride
type DevicePosture ¶
type DevicePosture struct {
Type DevicePostureType `json:"type"` // Current posture of the device
}
DevicePosture [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-DevicePosture
type DevicePostureType ¶
type DevicePostureType string
DevicePostureType current posture of the device.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-DevicePosture
const ( DevicePostureTypeContinuous DevicePostureType = "continuous" DevicePostureTypeFolded DevicePostureType = "folded" )
DevicePostureType values.
func (DevicePostureType) String ¶
func (t DevicePostureType) String() string
String returns the DevicePostureType as string value.
func (*DevicePostureType) UnmarshalJSON ¶
func (t *DevicePostureType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type DisabledImageType ¶
type DisabledImageType string
DisabledImageType enum of image types that can be disabled.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-DisabledImageType
const ( DisabledImageTypeAvif DisabledImageType = "avif" DisabledImageTypeJxl DisabledImageType = "jxl" DisabledImageTypeWebp DisabledImageType = "webp" )
DisabledImageType values.
func (DisabledImageType) String ¶
func (t DisabledImageType) String() string
String returns the DisabledImageType as string value.
func (*DisabledImageType) UnmarshalJSON ¶
func (t *DisabledImageType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type DisplayFeature ¶
type DisplayFeature struct {
Orientation DisplayFeatureOrientation `json:"orientation"` // Orientation of a display feature in relation to screen
Offset int64 `json:"offset"` // The offset from the screen origin in either the x (for vertical orientation) or y (for horizontal orientation) direction.
MaskLength int64 `json:"maskLength"` // A display feature may mask content such that it is not physically displayed - this length along with the offset describes this area. A display feature that only splits content will have a 0 mask_length.
}
DisplayFeature [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-DisplayFeature
type DisplayFeatureOrientation ¶
type DisplayFeatureOrientation string
DisplayFeatureOrientation orientation of a display feature in relation to screen.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-DisplayFeature
const ( DisplayFeatureOrientationVertical DisplayFeatureOrientation = "vertical" DisplayFeatureOrientationHorizontal DisplayFeatureOrientation = "horizontal" )
DisplayFeatureOrientation values.
func (DisplayFeatureOrientation) String ¶
func (t DisplayFeatureOrientation) String() string
String returns the DisplayFeatureOrientation as string value.
func (*DisplayFeatureOrientation) UnmarshalJSON ¶
func (t *DisplayFeatureOrientation) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type EventScreenOrientationLockChanged ¶
type EventScreenOrientationLockChanged struct {
Locked bool `json:"locked"` // Whether the screen orientation is currently locked.
Orientation *ScreenOrientation `json:"orientation,omitempty,omitzero"` // The orientation lock type requested by the page. Only set when locked is true.
}
EventScreenOrientationLockChanged fired when a page calls screen.orientation.lock() or screen.orientation.unlock() while device emulation is enabled. This allows the DevTools frontend to update the emulated device orientation accordingly.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#event-screenOrientationLockChanged
type EventVirtualTimeBudgetExpired ¶
type EventVirtualTimeBudgetExpired struct{}
EventVirtualTimeBudgetExpired notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#event-virtualTimeBudgetExpired
type GetOverriddenSensorInformationParams ¶
type GetOverriddenSensorInformationParams struct {
Type SensorType `json:"type"`
}
GetOverriddenSensorInformationParams [no description].
func GetOverriddenSensorInformation ¶
func GetOverriddenSensorInformation(typeVal SensorType) *GetOverriddenSensorInformationParams
GetOverriddenSensorInformation [no description].
parameters:
type
type GetOverriddenSensorInformationReturns ¶
type GetOverriddenSensorInformationReturns struct {
RequestedSamplingFrequency float64 `json:"requestedSamplingFrequency,omitempty,omitzero"`
}
GetOverriddenSensorInformationReturns return values.
type GetScreenInfosParams ¶
type GetScreenInfosParams struct{}
GetScreenInfosParams returns device's screen configuration. In headful mode, the physical screens configuration is returned, whereas in headless mode, a virtual headless screen configuration is provided instead.
func GetScreenInfos ¶
func GetScreenInfos() *GetScreenInfosParams
GetScreenInfos returns device's screen configuration. In headful mode, the physical screens configuration is returned, whereas in headless mode, a virtual headless screen configuration is provided instead.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-getScreenInfos
func (*GetScreenInfosParams) Do ¶
func (p *GetScreenInfosParams) Do(ctx context.Context) (screenInfos []*ScreenInfo, err error)
Do executes Emulation.getScreenInfos against the provided context.
returns:
screenInfos
type GetScreenInfosReturns ¶
type GetScreenInfosReturns struct {
ScreenInfos []*ScreenInfo `json:"screenInfos,omitempty,omitzero"`
}
GetScreenInfosReturns return values.
type MediaFeature ¶
MediaFeature [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-MediaFeature
type OrientationType ¶
type OrientationType string
OrientationType orientation type.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-ScreenOrientation
const ( OrientationTypePortraitPrimary OrientationType = "portraitPrimary" OrientationTypePortraitSecondary OrientationType = "portraitSecondary" OrientationTypeLandscapePrimary OrientationType = "landscapePrimary" OrientationTypeLandscapeSecondary OrientationType = "landscapeSecondary" )
OrientationType values.
func (OrientationType) String ¶
func (t OrientationType) String() string
String returns the OrientationType as string value.
func (*OrientationType) UnmarshalJSON ¶
func (t *OrientationType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type PressureMetadata ¶
type PressureMetadata struct {
Available bool `json:"available"`
}
PressureMetadata [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-PressureMetadata
type PressureSource ¶
type PressureSource string
PressureSource [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-PressureSource
const (
PressureSourceCPU PressureSource = "cpu"
)
PressureSource values.
func (PressureSource) String ¶
func (t PressureSource) String() string
String returns the PressureSource as string value.
func (*PressureSource) UnmarshalJSON ¶
func (t *PressureSource) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type PressureState ¶
type PressureState string
PressureState [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-PressureState
const ( PressureStateNominal PressureState = "nominal" PressureStateFair PressureState = "fair" PressureStateSerious PressureState = "serious" PressureStateCritical PressureState = "critical" )
PressureState values.
func (PressureState) String ¶
func (t PressureState) String() string
String returns the PressureState as string value.
func (*PressureState) UnmarshalJSON ¶
func (t *PressureState) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type RemoveScreenParams ¶
type RemoveScreenParams struct {
ScreenID ScreenID `json:"screenId"`
}
RemoveScreenParams remove screen from the device. Only supported in headless mode.
func RemoveScreen ¶
func RemoveScreen(screenID ScreenID) *RemoveScreenParams
RemoveScreen remove screen from the device. Only supported in headless mode.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-removeScreen
parameters:
screenID
type ResetPageScaleFactorParams ¶
type ResetPageScaleFactorParams struct{}
ResetPageScaleFactorParams requests that page scale factor is reset to initial values.
func ResetPageScaleFactor ¶
func ResetPageScaleFactor() *ResetPageScaleFactorParams
ResetPageScaleFactor requests that page scale factor is reset to initial values.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-resetPageScaleFactor
type SafeAreaInsets ¶
type SafeAreaInsets struct {
Top int64 `json:"top,omitempty,omitzero"` // Overrides safe-area-inset-top.
TopMax int64 `json:"topMax,omitempty,omitzero"` // Overrides safe-area-max-inset-top.
Left int64 `json:"left,omitempty,omitzero"` // Overrides safe-area-inset-left.
LeftMax int64 `json:"leftMax,omitempty,omitzero"` // Overrides safe-area-max-inset-left.
Bottom int64 `json:"bottom,omitempty,omitzero"` // Overrides safe-area-inset-bottom.
BottomMax int64 `json:"bottomMax,omitempty,omitzero"` // Overrides safe-area-max-inset-bottom.
Right int64 `json:"right,omitempty,omitzero"` // Overrides safe-area-inset-right.
RightMax int64 `json:"rightMax,omitempty,omitzero"` // Overrides safe-area-max-inset-right.
}
SafeAreaInsets [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-SafeAreaInsets
type ScreenID ¶
type ScreenID string
ScreenID [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-ScreenId
type ScreenInfo ¶
type ScreenInfo struct {
Left int64 `json:"left"` // Offset of the left edge of the screen.
Top int64 `json:"top"` // Offset of the top edge of the screen.
Width int64 `json:"width"` // Width of the screen.
Height int64 `json:"height"` // Height of the screen.
AvailLeft int64 `json:"availLeft"` // Offset of the left edge of the available screen area.
AvailTop int64 `json:"availTop"` // Offset of the top edge of the available screen area.
AvailWidth int64 `json:"availWidth"` // Width of the available screen area.
AvailHeight int64 `json:"availHeight"` // Height of the available screen area.
DevicePixelRatio float64 `json:"devicePixelRatio"` // Specifies the screen's device pixel ratio.
Orientation *ScreenOrientation `json:"orientation"` // Specifies the screen's orientation.
ColorDepth int64 `json:"colorDepth"` // Specifies the screen's color depth in bits.
IsExtended bool `json:"isExtended"` // Indicates whether the device has multiple screens.
IsInternal bool `json:"isInternal"` // Indicates whether the screen is internal to the device or external, attached to the device.
IsPrimary bool `json:"isPrimary"` // Indicates whether the screen is set as the the operating system primary screen.
Label string `json:"label"` // Specifies the descriptive label for the screen.
ID ScreenID `json:"id"` // Specifies the unique identifier of the screen.
}
ScreenInfo screen information similar to the one returned by window.getScreenDetails() method, see https://w3c.github.io/window-management/#screendetailed.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-ScreenInfo
type ScreenOrientation ¶
type ScreenOrientation struct {
Type OrientationType `json:"type"` // Orientation type.
Angle int64 `json:"angle"` // Orientation angle.
}
ScreenOrientation screen orientation.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-ScreenOrientation
type SensorMetadata ¶
type SensorMetadata struct {
Available bool `json:"available"`
MinimumFrequency float64 `json:"minimumFrequency,omitempty,omitzero"`
MaximumFrequency float64 `json:"maximumFrequency,omitempty,omitzero"`
}
SensorMetadata [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-SensorMetadata
type SensorReading ¶
type SensorReading struct {
Single *SensorReadingSingle `json:"single,omitempty,omitzero"`
Xyz *SensorReadingXYZ `json:"xyz,omitempty,omitzero"`
Quaternion *SensorReadingQuaternion `json:"quaternion,omitempty,omitzero"`
}
SensorReading [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-SensorReading
type SensorReadingQuaternion ¶
type SensorReadingQuaternion struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Z float64 `json:"z"`
W float64 `json:"w"`
}
SensorReadingQuaternion [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-SensorReadingQuaternion
type SensorReadingSingle ¶
type SensorReadingSingle struct {
Value float64 `json:"value"`
}
SensorReadingSingle [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-SensorReadingSingle
type SensorReadingXYZ ¶
SensorReadingXYZ [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-SensorReadingXYZ
type SensorType ¶
type SensorType string
SensorType used to specify sensor types to emulate. See https://w3c.github.io/sensors/#automation for more information.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-SensorType
const ( SensorTypeAbsoluteOrientation SensorType = "absolute-orientation" SensorTypeAccelerometer SensorType = "accelerometer" SensorTypeAmbientLight SensorType = "ambient-light" SensorTypeGravity SensorType = "gravity" SensorTypeGyroscope SensorType = "gyroscope" SensorTypeLinearAcceleration SensorType = "linear-acceleration" SensorTypeMagnetometer SensorType = "magnetometer" SensorTypeRelativeOrientation SensorType = "relative-orientation" )
SensorType values.
func (SensorType) String ¶
func (t SensorType) String() string
String returns the SensorType as string value.
func (*SensorType) UnmarshalJSON ¶
func (t *SensorType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type SetAutoDarkModeOverrideParams ¶
type SetAutoDarkModeOverrideParams struct {
Enabled bool `json:"enabled"` // Whether to enable or disable automatic dark mode. If not specified, any existing override will be cleared.
}
SetAutoDarkModeOverrideParams automatically render all web contents using a dark theme.
func SetAutoDarkModeOverride ¶
func SetAutoDarkModeOverride() *SetAutoDarkModeOverrideParams
SetAutoDarkModeOverride automatically render all web contents using a dark theme.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setAutoDarkModeOverride
parameters:
func (*SetAutoDarkModeOverrideParams) Do ¶
func (p *SetAutoDarkModeOverrideParams) Do(ctx context.Context) (err error)
Do executes Emulation.setAutoDarkModeOverride against the provided context.
func (SetAutoDarkModeOverrideParams) WithEnabled ¶
func (p SetAutoDarkModeOverrideParams) WithEnabled(enabled bool) *SetAutoDarkModeOverrideParams
WithEnabled whether to enable or disable automatic dark mode. If not specified, any existing override will be cleared.
type SetAutomationOverrideParams ¶
type SetAutomationOverrideParams struct {
Enabled bool `json:"enabled"` // Whether the override should be enabled.
}
SetAutomationOverrideParams allows overriding the automation flag.
func SetAutomationOverride ¶
func SetAutomationOverride(enabled bool) *SetAutomationOverrideParams
SetAutomationOverride allows overriding the automation flag.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setAutomationOverride
parameters:
enabled - Whether the override should be enabled.
type SetCPUThrottlingRateParams ¶
type SetCPUThrottlingRateParams struct {
Rate float64 `json:"rate"` // Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
}
SetCPUThrottlingRateParams enables CPU throttling to emulate slow CPUs.
func SetCPUThrottlingRate ¶
func SetCPUThrottlingRate(rate float64) *SetCPUThrottlingRateParams
SetCPUThrottlingRate enables CPU throttling to emulate slow CPUs.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setCPUThrottlingRate
parameters:
rate - Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
type SetDataSaverOverrideParams ¶
type SetDataSaverOverrideParams struct {
DataSaverEnabled bool `json:"dataSaverEnabled"` // Override value. Omitting the parameter disables the override.
}
SetDataSaverOverrideParams override the value of navigator.connection.saveData.
func SetDataSaverOverride ¶
func SetDataSaverOverride() *SetDataSaverOverrideParams
SetDataSaverOverride override the value of navigator.connection.saveData.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDataSaverOverride
parameters:
func (*SetDataSaverOverrideParams) Do ¶
func (p *SetDataSaverOverrideParams) Do(ctx context.Context) (err error)
Do executes Emulation.setDataSaverOverride against the provided context.
func (SetDataSaverOverrideParams) WithDataSaverEnabled ¶
func (p SetDataSaverOverrideParams) WithDataSaverEnabled(dataSaverEnabled bool) *SetDataSaverOverrideParams
WithDataSaverEnabled override value. Omitting the parameter disables the override.
type SetDefaultBackgroundColorOverrideParams ¶
type SetDefaultBackgroundColorOverrideParams struct {
Color *cdp.RGBA `json:"color,omitempty,omitzero"` // RGBA of the default background color. If not specified, any existing override will be cleared.
}
SetDefaultBackgroundColorOverrideParams sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.
func SetDefaultBackgroundColorOverride ¶
func SetDefaultBackgroundColorOverride() *SetDefaultBackgroundColorOverrideParams
SetDefaultBackgroundColorOverride sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.
parameters:
func (*SetDefaultBackgroundColorOverrideParams) Do ¶
func (p *SetDefaultBackgroundColorOverrideParams) Do(ctx context.Context) (err error)
Do executes Emulation.setDefaultBackgroundColorOverride against the provided context.
func (SetDefaultBackgroundColorOverrideParams) WithColor ¶
func (p SetDefaultBackgroundColorOverrideParams) WithColor(color *cdp.RGBA) *SetDefaultBackgroundColorOverrideParams
WithColor rGBA of the default background color. If not specified, any existing override will be cleared.
type SetDeviceMetricsOverrideParams ¶
type SetDeviceMetricsOverrideParams struct {
Width int64 `json:"width"` // Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override.
Height int64 `json:"height"` // Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override.
DeviceScaleFactor float64 `json:"deviceScaleFactor"` // Overriding device scale factor value. 0 disables the override.
Mobile bool `json:"mobile"` // Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
Scale float64 `json:"scale,omitempty,omitzero"` // Scale to apply to resulting view image.
ScreenWidth int64 `json:"screenWidth,omitempty,omitzero"` // Overriding screen width value in pixels (minimum 0, maximum 10000000).
ScreenHeight int64 `json:"screenHeight,omitempty,omitzero"` // Overriding screen height value in pixels (minimum 0, maximum 10000000).
PositionX int64 `json:"positionX,omitempty,omitzero"` // Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
PositionY int64 `json:"positionY,omitempty,omitzero"` // Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
DontSetVisibleSize bool `json:"dontSetVisibleSize"` // Do not set visible view size, rely upon explicit setVisibleSize call.
ScreenOrientation *ScreenOrientation `json:"screenOrientation,omitempty,omitzero"` // Screen orientation override.
Viewport *page.Viewport `json:"viewport,omitempty,omitzero"` // If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
ScrollbarType SetDeviceMetricsOverrideScrollbarType `json:"scrollbarType,omitempty,omitzero"` // Scrollbar type. Default: default.
ScreenOrientationLockEmulation bool `json:"screenOrientationLockEmulation"` // If set to true, enables screen orientation lock emulation, which intercepts screen.orientation.lock() calls from the page and reports orientation changes via screenOrientationLockChanged events. This is useful for emulating mobile device orientation lock behavior in responsive design mode.
}
SetDeviceMetricsOverrideParams overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).
func SetDeviceMetricsOverride ¶
func SetDeviceMetricsOverride(width int64, height int64, deviceScaleFactor float64, mobile bool) *SetDeviceMetricsOverrideParams
SetDeviceMetricsOverride overrides the values of device screen dimensions (window.screen.width, window.screen.height, window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media query results).
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDeviceMetricsOverride
parameters:
width - Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. height - Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. deviceScaleFactor - Overriding device scale factor value. 0 disables the override. mobile - Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more.
func (*SetDeviceMetricsOverrideParams) Do ¶
func (p *SetDeviceMetricsOverrideParams) Do(ctx context.Context) (err error)
Do executes Emulation.setDeviceMetricsOverride against the provided context.
func (SetDeviceMetricsOverrideParams) WithDontSetVisibleSize ¶
func (p SetDeviceMetricsOverrideParams) WithDontSetVisibleSize(dontSetVisibleSize bool) *SetDeviceMetricsOverrideParams
WithDontSetVisibleSize do not set visible view size, rely upon explicit setVisibleSize call.
func (SetDeviceMetricsOverrideParams) WithPositionX ¶
func (p SetDeviceMetricsOverrideParams) WithPositionX(positionX int64) *SetDeviceMetricsOverrideParams
WithPositionX overriding view X position on screen in pixels (minimum 0, maximum 10000000).
func (SetDeviceMetricsOverrideParams) WithPositionY ¶
func (p SetDeviceMetricsOverrideParams) WithPositionY(positionY int64) *SetDeviceMetricsOverrideParams
WithPositionY overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
func (SetDeviceMetricsOverrideParams) WithScale ¶
func (p SetDeviceMetricsOverrideParams) WithScale(scale float64) *SetDeviceMetricsOverrideParams
WithScale scale to apply to resulting view image.
func (SetDeviceMetricsOverrideParams) WithScreenHeight ¶
func (p SetDeviceMetricsOverrideParams) WithScreenHeight(screenHeight int64) *SetDeviceMetricsOverrideParams
WithScreenHeight overriding screen height value in pixels (minimum 0, maximum 10000000).
func (SetDeviceMetricsOverrideParams) WithScreenOrientation ¶
func (p SetDeviceMetricsOverrideParams) WithScreenOrientation(screenOrientation *ScreenOrientation) *SetDeviceMetricsOverrideParams
WithScreenOrientation screen orientation override.
func (SetDeviceMetricsOverrideParams) WithScreenOrientationLockEmulation ¶
func (p SetDeviceMetricsOverrideParams) WithScreenOrientationLockEmulation(screenOrientationLockEmulation bool) *SetDeviceMetricsOverrideParams
WithScreenOrientationLockEmulation if set to true, enables screen orientation lock emulation, which intercepts screen.orientation.lock() calls from the page and reports orientation changes via screenOrientationLockChanged events. This is useful for emulating mobile device orientation lock behavior in responsive design mode.
func (SetDeviceMetricsOverrideParams) WithScreenWidth ¶
func (p SetDeviceMetricsOverrideParams) WithScreenWidth(screenWidth int64) *SetDeviceMetricsOverrideParams
WithScreenWidth overriding screen width value in pixels (minimum 0, maximum 10000000).
func (SetDeviceMetricsOverrideParams) WithScrollbarType ¶
func (p SetDeviceMetricsOverrideParams) WithScrollbarType(scrollbarType SetDeviceMetricsOverrideScrollbarType) *SetDeviceMetricsOverrideParams
WithScrollbarType scrollbar type. Default: default.
func (SetDeviceMetricsOverrideParams) WithViewport ¶
func (p SetDeviceMetricsOverrideParams) WithViewport(viewport *page.Viewport) *SetDeviceMetricsOverrideParams
WithViewport if set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
type SetDeviceMetricsOverrideScrollbarType ¶
type SetDeviceMetricsOverrideScrollbarType string
SetDeviceMetricsOverrideScrollbarType scrollbar type. Default: default.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDeviceMetricsOverride
const ( SetDeviceMetricsOverrideScrollbarTypeOverlay SetDeviceMetricsOverrideScrollbarType = "overlay" SetDeviceMetricsOverrideScrollbarTypeDefault SetDeviceMetricsOverrideScrollbarType = "default" )
SetDeviceMetricsOverrideScrollbarType values.
func (SetDeviceMetricsOverrideScrollbarType) String ¶
func (t SetDeviceMetricsOverrideScrollbarType) String() string
String returns the SetDeviceMetricsOverrideScrollbarType as string value.
func (*SetDeviceMetricsOverrideScrollbarType) UnmarshalJSON ¶
func (t *SetDeviceMetricsOverrideScrollbarType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type SetDevicePostureOverrideParams ¶
type SetDevicePostureOverrideParams struct {
Posture *DevicePosture `json:"posture"`
}
SetDevicePostureOverrideParams start reporting the given posture value to the Device Posture API. This override can also be set in setDeviceMetricsOverride().
func SetDevicePostureOverride ¶
func SetDevicePostureOverride(posture *DevicePosture) *SetDevicePostureOverrideParams
SetDevicePostureOverride start reporting the given posture value to the Device Posture API. This override can also be set in setDeviceMetricsOverride().
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDevicePostureOverride
parameters:
posture
type SetDisabledImageTypesParams ¶
type SetDisabledImageTypesParams struct {
ImageTypes []DisabledImageType `json:"imageTypes"` // Image types to disable.
}
SetDisabledImageTypesParams [no description].
func SetDisabledImageTypes ¶
func SetDisabledImageTypes(imageTypes []DisabledImageType) *SetDisabledImageTypesParams
SetDisabledImageTypes [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDisabledImageTypes
parameters:
imageTypes - Image types to disable.
type SetDisplayFeaturesOverrideParams ¶
type SetDisplayFeaturesOverrideParams struct {
Features []*DisplayFeature `json:"features"`
}
SetDisplayFeaturesOverrideParams start using the given display features to pupulate the Viewport Segments API. This override can also be set in setDeviceMetricsOverride().
func SetDisplayFeaturesOverride ¶
func SetDisplayFeaturesOverride(features []*DisplayFeature) *SetDisplayFeaturesOverrideParams
SetDisplayFeaturesOverride start using the given display features to pupulate the Viewport Segments API. This override can also be set in setDeviceMetricsOverride().
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDisplayFeaturesOverride
parameters:
features
type SetDocumentCookieDisabledParams ¶
type SetDocumentCookieDisabledParams struct {
Disabled bool `json:"disabled"` // Whether document.coookie API should be disabled.
}
SetDocumentCookieDisabledParams [no description].
func SetDocumentCookieDisabled ¶
func SetDocumentCookieDisabled(disabled bool) *SetDocumentCookieDisabledParams
SetDocumentCookieDisabled [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setDocumentCookieDisabled
parameters:
disabled - Whether document.coookie API should be disabled.
type SetEmitTouchEventsForMouseConfiguration ¶
type SetEmitTouchEventsForMouseConfiguration string
SetEmitTouchEventsForMouseConfiguration touch/gesture events configuration. Default: current platform.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmitTouchEventsForMouse
const ( SetEmitTouchEventsForMouseConfigurationMobile SetEmitTouchEventsForMouseConfiguration = "mobile" SetEmitTouchEventsForMouseConfigurationDesktop SetEmitTouchEventsForMouseConfiguration = "desktop" )
SetEmitTouchEventsForMouseConfiguration values.
func (SetEmitTouchEventsForMouseConfiguration) String ¶
func (t SetEmitTouchEventsForMouseConfiguration) String() string
String returns the SetEmitTouchEventsForMouseConfiguration as string value.
func (*SetEmitTouchEventsForMouseConfiguration) UnmarshalJSON ¶
func (t *SetEmitTouchEventsForMouseConfiguration) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type SetEmitTouchEventsForMouseParams ¶
type SetEmitTouchEventsForMouseParams struct {
Enabled bool `json:"enabled"` // Whether touch emulation based on mouse input should be enabled.
Configuration SetEmitTouchEventsForMouseConfiguration `json:"configuration,omitempty,omitzero"` // Touch/gesture events configuration. Default: current platform.
}
SetEmitTouchEventsForMouseParams [no description].
func SetEmitTouchEventsForMouse ¶
func SetEmitTouchEventsForMouse(enabled bool) *SetEmitTouchEventsForMouseParams
SetEmitTouchEventsForMouse [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmitTouchEventsForMouse
parameters:
enabled - Whether touch emulation based on mouse input should be enabled.
func (*SetEmitTouchEventsForMouseParams) Do ¶
func (p *SetEmitTouchEventsForMouseParams) Do(ctx context.Context) (err error)
Do executes Emulation.setEmitTouchEventsForMouse against the provided context.
func (SetEmitTouchEventsForMouseParams) WithConfiguration ¶
func (p SetEmitTouchEventsForMouseParams) WithConfiguration(configuration SetEmitTouchEventsForMouseConfiguration) *SetEmitTouchEventsForMouseParams
WithConfiguration touch/gesture events configuration. Default: current platform.
type SetEmulatedMediaParams ¶
type SetEmulatedMediaParams struct {
Media string `json:"media,omitempty,omitzero"` // Media type to emulate. Empty string disables the override.
Features []*MediaFeature `json:"features,omitempty,omitzero"` // Media features to emulate.
}
SetEmulatedMediaParams emulates the given media type or media feature for CSS media queries.
func SetEmulatedMedia ¶
func SetEmulatedMedia() *SetEmulatedMediaParams
SetEmulatedMedia emulates the given media type or media feature for CSS media queries.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmulatedMedia
parameters:
func (*SetEmulatedMediaParams) Do ¶
func (p *SetEmulatedMediaParams) Do(ctx context.Context) (err error)
Do executes Emulation.setEmulatedMedia against the provided context.
func (SetEmulatedMediaParams) WithFeatures ¶
func (p SetEmulatedMediaParams) WithFeatures(features []*MediaFeature) *SetEmulatedMediaParams
WithFeatures media features to emulate.
func (SetEmulatedMediaParams) WithMedia ¶
func (p SetEmulatedMediaParams) WithMedia(media string) *SetEmulatedMediaParams
WithMedia media type to emulate. Empty string disables the override.
type SetEmulatedOSTextScaleParams ¶
type SetEmulatedOSTextScaleParams struct {
Scale float64 `json:"scale,omitempty,omitzero"`
}
SetEmulatedOSTextScaleParams emulates the given OS text scale.
func SetEmulatedOSTextScale ¶
func SetEmulatedOSTextScale() *SetEmulatedOSTextScaleParams
SetEmulatedOSTextScale emulates the given OS text scale.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmulatedOSTextScale
parameters:
func (*SetEmulatedOSTextScaleParams) Do ¶
func (p *SetEmulatedOSTextScaleParams) Do(ctx context.Context) (err error)
Do executes Emulation.setEmulatedOSTextScale against the provided context.
func (SetEmulatedOSTextScaleParams) WithScale ¶
func (p SetEmulatedOSTextScaleParams) WithScale(scale float64) *SetEmulatedOSTextScaleParams
WithScale [no description].
type SetEmulatedVisionDeficiencyParams ¶
type SetEmulatedVisionDeficiencyParams struct {
Type SetEmulatedVisionDeficiencyType `json:"type"` // Vision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies.
}
SetEmulatedVisionDeficiencyParams emulates the given vision deficiency.
func SetEmulatedVisionDeficiency ¶
func SetEmulatedVisionDeficiency(typeVal SetEmulatedVisionDeficiencyType) *SetEmulatedVisionDeficiencyParams
SetEmulatedVisionDeficiency emulates the given vision deficiency.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmulatedVisionDeficiency
parameters:
type - Vision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies.
type SetEmulatedVisionDeficiencyType ¶
type SetEmulatedVisionDeficiencyType string
SetEmulatedVisionDeficiencyType vision deficiency to emulate. Order: best-effort emulations come first, followed by any physiologically accurate emulations for medically recognized color vision deficiencies.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setEmulatedVisionDeficiency
const ( SetEmulatedVisionDeficiencyTypeNone SetEmulatedVisionDeficiencyType = "none" SetEmulatedVisionDeficiencyTypeBlurredVision SetEmulatedVisionDeficiencyType = "blurredVision" SetEmulatedVisionDeficiencyTypeReducedContrast SetEmulatedVisionDeficiencyType = "reducedContrast" SetEmulatedVisionDeficiencyTypeAchromatopsia SetEmulatedVisionDeficiencyType = "achromatopsia" SetEmulatedVisionDeficiencyTypeDeuteranopia SetEmulatedVisionDeficiencyType = "deuteranopia" SetEmulatedVisionDeficiencyTypeProtanopia SetEmulatedVisionDeficiencyType = "protanopia" SetEmulatedVisionDeficiencyTypeTritanopia SetEmulatedVisionDeficiencyType = "tritanopia" )
SetEmulatedVisionDeficiencyType values.
func (SetEmulatedVisionDeficiencyType) String ¶
func (t SetEmulatedVisionDeficiencyType) String() string
String returns the SetEmulatedVisionDeficiencyType as string value.
func (*SetEmulatedVisionDeficiencyType) UnmarshalJSON ¶
func (t *SetEmulatedVisionDeficiencyType) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type SetFocusEmulationEnabledParams ¶
type SetFocusEmulationEnabledParams struct {
Enabled bool `json:"enabled"` // Whether to enable to disable focus emulation.
}
SetFocusEmulationEnabledParams enables or disables simulating a focused and active page.
func SetFocusEmulationEnabled ¶
func SetFocusEmulationEnabled(enabled bool) *SetFocusEmulationEnabledParams
SetFocusEmulationEnabled enables or disables simulating a focused and active page.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setFocusEmulationEnabled
parameters:
enabled - Whether to enable to disable focus emulation.
type SetGeolocationOverrideParams ¶
type SetGeolocationOverrideParams struct {
Latitude float64 `json:"latitude,omitempty,omitzero"` // Mock latitude
Longitude float64 `json:"longitude,omitempty,omitzero"` // Mock longitude
Accuracy float64 `json:"accuracy,omitempty,omitzero"` // Mock accuracy
Altitude float64 `json:"altitude,omitempty,omitzero"` // Mock altitude
AltitudeAccuracy float64 `json:"altitudeAccuracy,omitempty,omitzero"` // Mock altitudeAccuracy
Heading float64 `json:"heading,omitempty,omitzero"` // Mock heading
Speed float64 `json:"speed,omitempty,omitzero"` // Mock speed
}
SetGeolocationOverrideParams overrides the Geolocation Position or Error. Omitting latitude, longitude or accuracy emulates position unavailable.
func SetGeolocationOverride ¶
func SetGeolocationOverride() *SetGeolocationOverrideParams
SetGeolocationOverride overrides the Geolocation Position or Error. Omitting latitude, longitude or accuracy emulates position unavailable.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setGeolocationOverride
parameters:
func (*SetGeolocationOverrideParams) Do ¶
func (p *SetGeolocationOverrideParams) Do(ctx context.Context) (err error)
Do executes Emulation.setGeolocationOverride against the provided context.
func (SetGeolocationOverrideParams) WithAccuracy ¶
func (p SetGeolocationOverrideParams) WithAccuracy(accuracy float64) *SetGeolocationOverrideParams
WithAccuracy mock accuracy.
func (SetGeolocationOverrideParams) WithAltitude ¶
func (p SetGeolocationOverrideParams) WithAltitude(altitude float64) *SetGeolocationOverrideParams
WithAltitude mock altitude.
func (SetGeolocationOverrideParams) WithAltitudeAccuracy ¶
func (p SetGeolocationOverrideParams) WithAltitudeAccuracy(altitudeAccuracy float64) *SetGeolocationOverrideParams
WithAltitudeAccuracy mock altitudeAccuracy.
func (SetGeolocationOverrideParams) WithHeading ¶
func (p SetGeolocationOverrideParams) WithHeading(heading float64) *SetGeolocationOverrideParams
WithHeading mock heading.
func (SetGeolocationOverrideParams) WithLatitude ¶
func (p SetGeolocationOverrideParams) WithLatitude(latitude float64) *SetGeolocationOverrideParams
WithLatitude mock latitude.
func (SetGeolocationOverrideParams) WithLongitude ¶
func (p SetGeolocationOverrideParams) WithLongitude(longitude float64) *SetGeolocationOverrideParams
WithLongitude mock longitude.
func (SetGeolocationOverrideParams) WithSpeed ¶
func (p SetGeolocationOverrideParams) WithSpeed(speed float64) *SetGeolocationOverrideParams
WithSpeed mock speed.
type SetHardwareConcurrencyOverrideParams ¶
type SetHardwareConcurrencyOverrideParams struct {
HardwareConcurrency int64 `json:"hardwareConcurrency"` // Hardware concurrency to report
}
SetHardwareConcurrencyOverrideParams [no description].
func SetHardwareConcurrencyOverride ¶
func SetHardwareConcurrencyOverride(hardwareConcurrency int64) *SetHardwareConcurrencyOverrideParams
SetHardwareConcurrencyOverride [no description].
parameters:
hardwareConcurrency - Hardware concurrency to report
type SetIdleOverrideParams ¶
type SetIdleOverrideParams struct {
IsUserActive bool `json:"isUserActive"` // Mock isUserActive
IsScreenUnlocked bool `json:"isScreenUnlocked"` // Mock isScreenUnlocked
}
SetIdleOverrideParams overrides the Idle state.
func SetIdleOverride ¶
func SetIdleOverride(isUserActive bool, isScreenUnlocked bool) *SetIdleOverrideParams
SetIdleOverride overrides the Idle state.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setIdleOverride
parameters:
isUserActive - Mock isUserActive isScreenUnlocked - Mock isScreenUnlocked
type SetLocaleOverrideParams ¶
type SetLocaleOverrideParams struct {
Locale string `json:"locale,omitempty,omitzero"` // ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale.
}
SetLocaleOverrideParams overrides default host system locale with the specified one.
func SetLocaleOverride ¶
func SetLocaleOverride() *SetLocaleOverrideParams
SetLocaleOverride overrides default host system locale with the specified one.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setLocaleOverride
parameters:
func (*SetLocaleOverrideParams) Do ¶
func (p *SetLocaleOverrideParams) Do(ctx context.Context) (err error)
Do executes Emulation.setLocaleOverride against the provided context.
func (SetLocaleOverrideParams) WithLocale ¶
func (p SetLocaleOverrideParams) WithLocale(locale string) *SetLocaleOverrideParams
WithLocale iCU style C locale (e.g. "en_US"). If not specified or empty, disables the override and restores default host system locale.
type SetPageScaleFactorParams ¶
type SetPageScaleFactorParams struct {
PageScaleFactor float64 `json:"pageScaleFactor"` // Page scale factor.
}
SetPageScaleFactorParams sets a specified page scale factor.
func SetPageScaleFactor ¶
func SetPageScaleFactor(pageScaleFactor float64) *SetPageScaleFactorParams
SetPageScaleFactor sets a specified page scale factor.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setPageScaleFactor
parameters:
pageScaleFactor - Page scale factor.
type SetPressureDataOverrideParams ¶
type SetPressureDataOverrideParams struct {
Source PressureSource `json:"source"`
State PressureState `json:"state"`
OwnContributionEstimate float64 `json:"ownContributionEstimate,omitempty,omitzero"`
}
SetPressureDataOverrideParams provides a given pressure data set that will be processed and eventually be delivered to PressureObserver users. |source| must have been previously overridden by setPressureSourceOverrideEnabled.
func SetPressureDataOverride ¶
func SetPressureDataOverride(source PressureSource, state PressureState) *SetPressureDataOverrideParams
SetPressureDataOverride provides a given pressure data set that will be processed and eventually be delivered to PressureObserver users. |source| must have been previously overridden by setPressureSourceOverrideEnabled.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setPressureDataOverride
parameters:
source state
func (*SetPressureDataOverrideParams) Do ¶
func (p *SetPressureDataOverrideParams) Do(ctx context.Context) (err error)
Do executes Emulation.setPressureDataOverride against the provided context.
func (SetPressureDataOverrideParams) WithOwnContributionEstimate ¶
func (p SetPressureDataOverrideParams) WithOwnContributionEstimate(ownContributionEstimate float64) *SetPressureDataOverrideParams
WithOwnContributionEstimate [no description].
type SetPressureSourceOverrideEnabledParams ¶
type SetPressureSourceOverrideEnabledParams struct {
Enabled bool `json:"enabled"`
Source PressureSource `json:"source"`
Metadata *PressureMetadata `json:"metadata,omitempty,omitzero"`
}
SetPressureSourceOverrideEnabledParams overrides a pressure source of a given type, as used by the Compute Pressure API, so that updates to PressureObserver.observe() are provided via setPressureStateOverride instead of being retrieved from platform-provided telemetry data.
func SetPressureSourceOverrideEnabled ¶
func SetPressureSourceOverrideEnabled(enabled bool, source PressureSource) *SetPressureSourceOverrideEnabledParams
SetPressureSourceOverrideEnabled overrides a pressure source of a given type, as used by the Compute Pressure API, so that updates to PressureObserver.observe() are provided via setPressureStateOverride instead of being retrieved from platform-provided telemetry data.
parameters:
enabled source
func (*SetPressureSourceOverrideEnabledParams) Do ¶
func (p *SetPressureSourceOverrideEnabledParams) Do(ctx context.Context) (err error)
Do executes Emulation.setPressureSourceOverrideEnabled against the provided context.
func (SetPressureSourceOverrideEnabledParams) WithMetadata ¶
func (p SetPressureSourceOverrideEnabledParams) WithMetadata(metadata *PressureMetadata) *SetPressureSourceOverrideEnabledParams
WithMetadata [no description].
type SetPressureStateOverrideParams ¶
type SetPressureStateOverrideParams struct {
Source PressureSource `json:"source"`
State PressureState `json:"state"`
}
SetPressureStateOverrideParams tODO: OBSOLETE: To remove when setPressureDataOverride is merged. Provides a given pressure state that will be processed and eventually be delivered to PressureObserver users. |source| must have been previously overridden by setPressureSourceOverrideEnabled.
func SetPressureStateOverride ¶
func SetPressureStateOverride(source PressureSource, state PressureState) *SetPressureStateOverrideParams
SetPressureStateOverride tODO: OBSOLETE: To remove when setPressureDataOverride is merged. Provides a given pressure state that will be processed and eventually be delivered to PressureObserver users. |source| must have been previously overridden by setPressureSourceOverrideEnabled.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setPressureStateOverride
parameters:
source state
type SetPrimaryScreenParams ¶
type SetPrimaryScreenParams struct {
ScreenID ScreenID `json:"screenId"`
}
SetPrimaryScreenParams set primary screen. Only supported in headless mode. Note that this changes the coordinate system origin to the top-left of the new primary screen, updating the bounds and work areas of all existing screens accordingly.
func SetPrimaryScreen ¶
func SetPrimaryScreen(screenID ScreenID) *SetPrimaryScreenParams
SetPrimaryScreen set primary screen. Only supported in headless mode. Note that this changes the coordinate system origin to the top-left of the new primary screen, updating the bounds and work areas of all existing screens accordingly.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setPrimaryScreen
parameters:
screenID
type SetSafeAreaInsetsOverrideParams ¶
type SetSafeAreaInsetsOverrideParams struct {
Insets *SafeAreaInsets `json:"insets"`
}
SetSafeAreaInsetsOverrideParams overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the respective variables to be undefined, even if previously overridden.
func SetSafeAreaInsetsOverride ¶
func SetSafeAreaInsetsOverride(insets *SafeAreaInsets) *SetSafeAreaInsetsOverrideParams
SetSafeAreaInsetsOverride overrides the values for env(safe-area-inset-*) and env(safe-area-max-inset-*). Unset values will cause the respective variables to be undefined, even if previously overridden.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setSafeAreaInsetsOverride
parameters:
insets
type SetScriptExecutionDisabledParams ¶
type SetScriptExecutionDisabledParams struct {
Value bool `json:"value"` // Whether script execution should be disabled in the page.
}
SetScriptExecutionDisabledParams switches script execution in the page.
func SetScriptExecutionDisabled ¶
func SetScriptExecutionDisabled(value bool) *SetScriptExecutionDisabledParams
SetScriptExecutionDisabled switches script execution in the page.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setScriptExecutionDisabled
parameters:
value - Whether script execution should be disabled in the page.
type SetScrollbarsHiddenParams ¶
type SetScrollbarsHiddenParams struct {
Hidden bool `json:"hidden"` // Whether scrollbars should be always hidden.
}
SetScrollbarsHiddenParams [no description].
func SetScrollbarsHidden ¶
func SetScrollbarsHidden(hidden bool) *SetScrollbarsHiddenParams
SetScrollbarsHidden [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setScrollbarsHidden
parameters:
hidden - Whether scrollbars should be always hidden.
type SetSensorOverrideEnabledParams ¶
type SetSensorOverrideEnabledParams struct {
Enabled bool `json:"enabled"`
Type SensorType `json:"type"`
Metadata *SensorMetadata `json:"metadata,omitempty,omitzero"`
}
SetSensorOverrideEnabledParams overrides a platform sensor of a given type. If |enabled| is true, calls to Sensor.start() will use a virtual sensor as backend rather than fetching data from a real hardware sensor. Otherwise, existing virtual sensor-backend Sensor objects will fire an error event and new calls to Sensor.start() will attempt to use a real sensor instead.
func SetSensorOverrideEnabled ¶
func SetSensorOverrideEnabled(enabled bool, typeVal SensorType) *SetSensorOverrideEnabledParams
SetSensorOverrideEnabled overrides a platform sensor of a given type. If |enabled| is true, calls to Sensor.start() will use a virtual sensor as backend rather than fetching data from a real hardware sensor. Otherwise, existing virtual sensor-backend Sensor objects will fire an error event and new calls to Sensor.start() will attempt to use a real sensor instead.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setSensorOverrideEnabled
parameters:
enabled type
func (*SetSensorOverrideEnabledParams) Do ¶
func (p *SetSensorOverrideEnabledParams) Do(ctx context.Context) (err error)
Do executes Emulation.setSensorOverrideEnabled against the provided context.
func (SetSensorOverrideEnabledParams) WithMetadata ¶
func (p SetSensorOverrideEnabledParams) WithMetadata(metadata *SensorMetadata) *SetSensorOverrideEnabledParams
WithMetadata [no description].
type SetSensorOverrideReadingsParams ¶
type SetSensorOverrideReadingsParams struct {
Type SensorType `json:"type"`
Reading *SensorReading `json:"reading"`
}
SetSensorOverrideReadingsParams updates the sensor readings reported by a sensor type previously overridden by setSensorOverrideEnabled.
func SetSensorOverrideReadings ¶
func SetSensorOverrideReadings(typeVal SensorType, reading *SensorReading) *SetSensorOverrideReadingsParams
SetSensorOverrideReadings updates the sensor readings reported by a sensor type previously overridden by setSensorOverrideEnabled.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setSensorOverrideReadings
parameters:
type reading
type SetSmallViewportHeightDifferenceOverrideParams ¶
type SetSmallViewportHeightDifferenceOverrideParams struct {
Difference int64 `json:"difference"` // This will cause an element of size 100svh to be difference pixels smaller than an element of size 100lvh.
}
SetSmallViewportHeightDifferenceOverrideParams allows overriding the difference between the small and large viewport sizes, which determine the value of the svh and lvh unit, respectively. Only supported for top-level frames.
func SetSmallViewportHeightDifferenceOverride ¶
func SetSmallViewportHeightDifferenceOverride(difference int64) *SetSmallViewportHeightDifferenceOverrideParams
SetSmallViewportHeightDifferenceOverride allows overriding the difference between the small and large viewport sizes, which determine the value of the svh and lvh unit, respectively. Only supported for top-level frames.
parameters:
difference - This will cause an element of size 100svh to be difference pixels smaller than an element of size 100lvh.
type SetTimezoneOverrideParams ¶
type SetTimezoneOverrideParams struct {
TimezoneID string `json:"timezoneId"` // The timezone identifier. List of supported timezones: https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt If empty, disables the override and restores default host system timezone.
}
SetTimezoneOverrideParams overrides default host system timezone with the specified one.
func SetTimezoneOverride ¶
func SetTimezoneOverride(timezoneID string) *SetTimezoneOverrideParams
SetTimezoneOverride overrides default host system timezone with the specified one.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setTimezoneOverride
parameters:
timezoneID - The timezone identifier. List of supported timezones: https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt If empty, disables the override and restores default host system timezone.
type SetTouchEmulationEnabledParams ¶
type SetTouchEmulationEnabledParams struct {
Enabled bool `json:"enabled"` // Whether the touch event emulation should be enabled.
MaxTouchPoints int64 `json:"maxTouchPoints,omitempty,omitzero"` // Maximum touch points supported. Defaults to one.
}
SetTouchEmulationEnabledParams enables touch on platforms which do not support them.
func SetTouchEmulationEnabled ¶
func SetTouchEmulationEnabled(enabled bool) *SetTouchEmulationEnabledParams
SetTouchEmulationEnabled enables touch on platforms which do not support them.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setTouchEmulationEnabled
parameters:
enabled - Whether the touch event emulation should be enabled.
func (*SetTouchEmulationEnabledParams) Do ¶
func (p *SetTouchEmulationEnabledParams) Do(ctx context.Context) (err error)
Do executes Emulation.setTouchEmulationEnabled against the provided context.
func (SetTouchEmulationEnabledParams) WithMaxTouchPoints ¶
func (p SetTouchEmulationEnabledParams) WithMaxTouchPoints(maxTouchPoints int64) *SetTouchEmulationEnabledParams
WithMaxTouchPoints maximum touch points supported. Defaults to one.
type SetUserAgentOverrideParams ¶
type SetUserAgentOverrideParams struct {
UserAgent string `json:"userAgent"` // User agent to use.
AcceptLanguage string `json:"acceptLanguage,omitempty,omitzero"` // Browser language to emulate.
Platform string `json:"platform,omitempty,omitzero"` // The platform navigator.platform should return.
UserAgentMetadata *UserAgentMetadata `json:"userAgentMetadata,omitempty,omitzero"` // To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
}
SetUserAgentOverrideParams allows overriding user agent with the given string. userAgentMetadata must be set for Client Hint headers to be sent.
func SetUserAgentOverride ¶
func SetUserAgentOverride(userAgent string) *SetUserAgentOverrideParams
SetUserAgentOverride allows overriding user agent with the given string. userAgentMetadata must be set for Client Hint headers to be sent.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setUserAgentOverride
parameters:
userAgent - User agent to use.
func (*SetUserAgentOverrideParams) Do ¶
func (p *SetUserAgentOverrideParams) Do(ctx context.Context) (err error)
Do executes Emulation.setUserAgentOverride against the provided context.
func (SetUserAgentOverrideParams) WithAcceptLanguage ¶
func (p SetUserAgentOverrideParams) WithAcceptLanguage(acceptLanguage string) *SetUserAgentOverrideParams
WithAcceptLanguage browser language to emulate.
func (SetUserAgentOverrideParams) WithPlatform ¶
func (p SetUserAgentOverrideParams) WithPlatform(platform string) *SetUserAgentOverrideParams
WithPlatform the platform navigator.platform should return.
func (SetUserAgentOverrideParams) WithUserAgentMetadata ¶
func (p SetUserAgentOverrideParams) WithUserAgentMetadata(userAgentMetadata *UserAgentMetadata) *SetUserAgentOverrideParams
WithUserAgentMetadata to be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData.
type SetVirtualTimePolicyParams ¶
type SetVirtualTimePolicyParams struct {
Policy VirtualTimePolicy `json:"policy"`
Budget float64 `json:"budget,omitempty,omitzero"` // If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
MaxVirtualTimeTaskStarvationCount int64 `json:"maxVirtualTimeTaskStarvationCount,omitempty,omitzero"` // If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
InitialVirtualTime *cdp.TimeSinceEpoch `json:"initialVirtualTime,omitempty,omitzero"` // If set, base::Time::Now will be overridden to initially return this value.
}
SetVirtualTimePolicyParams turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy. Note this supersedes any previous time budget.
func SetVirtualTimePolicy ¶
func SetVirtualTimePolicy(policy VirtualTimePolicy) *SetVirtualTimePolicyParams
SetVirtualTimePolicy turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets the current virtual time policy. Note this supersedes any previous time budget.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-setVirtualTimePolicy
parameters:
policy
func (*SetVirtualTimePolicyParams) Do ¶
func (p *SetVirtualTimePolicyParams) Do(ctx context.Context) (virtualTimeTicksBase float64, err error)
Do executes Emulation.setVirtualTimePolicy against the provided context.
returns:
virtualTimeTicksBase - Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
func (SetVirtualTimePolicyParams) WithBudget ¶
func (p SetVirtualTimePolicyParams) WithBudget(budget float64) *SetVirtualTimePolicyParams
WithBudget if set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
func (SetVirtualTimePolicyParams) WithInitialVirtualTime ¶
func (p SetVirtualTimePolicyParams) WithInitialVirtualTime(initialVirtualTime *cdp.TimeSinceEpoch) *SetVirtualTimePolicyParams
WithInitialVirtualTime if set, base::Time::Now will be overridden to initially return this value.
func (SetVirtualTimePolicyParams) WithMaxVirtualTimeTaskStarvationCount ¶
func (p SetVirtualTimePolicyParams) WithMaxVirtualTimeTaskStarvationCount(maxVirtualTimeTaskStarvationCount int64) *SetVirtualTimePolicyParams
WithMaxVirtualTimeTaskStarvationCount if set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
type SetVirtualTimePolicyReturns ¶
type SetVirtualTimePolicyReturns struct {
VirtualTimeTicksBase float64 `json:"virtualTimeTicksBase,omitempty,omitzero"` // Absolute timestamp at which virtual time was first enabled (up time in milliseconds).
}
SetVirtualTimePolicyReturns return values.
type UpdateScreenParams ¶
type UpdateScreenParams struct {
ScreenID ScreenID `json:"screenId"` // Target screen identifier.
Left int64 `json:"left,omitempty,omitzero"` // Offset of the left edge of the screen in pixels.
Top int64 `json:"top,omitempty,omitzero"` // Offset of the top edge of the screen in pixels.
Width int64 `json:"width,omitempty,omitzero"` // The width of the screen in pixels.
Height int64 `json:"height,omitempty,omitzero"` // The height of the screen in pixels.
WorkAreaInsets *WorkAreaInsets `json:"workAreaInsets,omitempty,omitzero"` // Specifies the screen's work area.
DevicePixelRatio float64 `json:"devicePixelRatio,omitempty,omitzero"` // Specifies the screen's device pixel ratio.
Rotation int64 `json:"rotation,omitempty,omitzero"` // Specifies the screen's rotation angle. Available values are 0, 90, 180 and 270.
ColorDepth int64 `json:"colorDepth,omitempty,omitzero"` // Specifies the screen's color depth in bits.
Label string `json:"label,omitempty,omitzero"` // Specifies the descriptive label for the screen.
IsInternal bool `json:"isInternal"` // Indicates whether the screen is internal to the device or external, attached to the device. Default is false.
}
UpdateScreenParams updates specified screen parameters. Only supported in headless mode.
func UpdateScreen ¶
func UpdateScreen(screenID ScreenID) *UpdateScreenParams
UpdateScreen updates specified screen parameters. Only supported in headless mode.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#method-updateScreen
parameters:
screenID - Target screen identifier.
func (*UpdateScreenParams) Do ¶
func (p *UpdateScreenParams) Do(ctx context.Context) (screenInfo *ScreenInfo, err error)
Do executes Emulation.updateScreen against the provided context.
returns:
screenInfo
func (UpdateScreenParams) WithColorDepth ¶
func (p UpdateScreenParams) WithColorDepth(colorDepth int64) *UpdateScreenParams
WithColorDepth specifies the screen's color depth in bits.
func (UpdateScreenParams) WithDevicePixelRatio ¶
func (p UpdateScreenParams) WithDevicePixelRatio(devicePixelRatio float64) *UpdateScreenParams
WithDevicePixelRatio specifies the screen's device pixel ratio.
func (UpdateScreenParams) WithHeight ¶
func (p UpdateScreenParams) WithHeight(height int64) *UpdateScreenParams
WithHeight the height of the screen in pixels.
func (UpdateScreenParams) WithIsInternal ¶
func (p UpdateScreenParams) WithIsInternal(isInternal bool) *UpdateScreenParams
WithIsInternal indicates whether the screen is internal to the device or external, attached to the device. Default is false.
func (UpdateScreenParams) WithLabel ¶
func (p UpdateScreenParams) WithLabel(label string) *UpdateScreenParams
WithLabel specifies the descriptive label for the screen.
func (UpdateScreenParams) WithLeft ¶
func (p UpdateScreenParams) WithLeft(left int64) *UpdateScreenParams
WithLeft offset of the left edge of the screen in pixels.
func (UpdateScreenParams) WithRotation ¶
func (p UpdateScreenParams) WithRotation(rotation int64) *UpdateScreenParams
WithRotation specifies the screen's rotation angle. Available values are 0, 90, 180 and 270.
func (UpdateScreenParams) WithTop ¶
func (p UpdateScreenParams) WithTop(top int64) *UpdateScreenParams
WithTop offset of the top edge of the screen in pixels.
func (UpdateScreenParams) WithWidth ¶
func (p UpdateScreenParams) WithWidth(width int64) *UpdateScreenParams
WithWidth the width of the screen in pixels.
func (UpdateScreenParams) WithWorkAreaInsets ¶
func (p UpdateScreenParams) WithWorkAreaInsets(workAreaInsets *WorkAreaInsets) *UpdateScreenParams
WithWorkAreaInsets specifies the screen's work area.
type UpdateScreenReturns ¶
type UpdateScreenReturns struct {
ScreenInfo *ScreenInfo `json:"screenInfo,omitempty,omitzero"`
}
UpdateScreenReturns return values.
type UserAgentBrandVersion ¶
UserAgentBrandVersion used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-UserAgentBrandVersion
type UserAgentMetadata ¶
type UserAgentMetadata struct {
Brands []*UserAgentBrandVersion `json:"brands,omitempty,omitzero"` // Brands appearing in Sec-CH-UA.
FullVersionList []*UserAgentBrandVersion `json:"fullVersionList,omitempty,omitzero"` // Brands appearing in Sec-CH-UA-Full-Version-List.
Platform string `json:"platform"`
PlatformVersion string `json:"platformVersion"`
Architecture string `json:"architecture"`
Model string `json:"model"`
Mobile bool `json:"mobile"`
Bitness string `json:"bitness,omitempty,omitzero"`
Wow64 bool `json:"wow64"`
FormFactors []string `json:"formFactors,omitempty,omitzero"` // Used to specify User Agent form-factor values. See https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors
}
UserAgentMetadata used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints Missing optional values will be filled in by the target with what it would normally use.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-UserAgentMetadata
type VirtualTimePolicy ¶
type VirtualTimePolicy string
VirtualTimePolicy advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to allow the next delayed task (if any) to run; pause: The virtual time base may not advance; pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending resource fetches.
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-VirtualTimePolicy
const ( VirtualTimePolicyAdvance VirtualTimePolicy = "advance" VirtualTimePolicyPause VirtualTimePolicy = "pause" VirtualTimePolicyPauseIfNetworkFetchesPending VirtualTimePolicy = "pauseIfNetworkFetchesPending" )
VirtualTimePolicy values.
func (VirtualTimePolicy) String ¶
func (t VirtualTimePolicy) String() string
String returns the VirtualTimePolicy as string value.
func (*VirtualTimePolicy) UnmarshalJSON ¶
func (t *VirtualTimePolicy) UnmarshalJSON(buf []byte) error
UnmarshalJSON satisfies [json.Unmarshaler].
type WorkAreaInsets ¶
type WorkAreaInsets struct {
Top int64 `json:"top,omitempty,omitzero"` // Work area top inset in pixels. Default is 0;
Left int64 `json:"left,omitempty,omitzero"` // Work area left inset in pixels. Default is 0;
Bottom int64 `json:"bottom,omitempty,omitzero"` // Work area bottom inset in pixels. Default is 0;
Right int64 `json:"right,omitempty,omitzero"` // Work area right inset in pixels. Default is 0;
}
WorkAreaInsets [no description].
See: https://chromedevtools.github.io/devtools-protocol/tot/Emulation#type-WorkAreaInsets