pub struct EmulationClient { /* private fields */ }Expand description
Client for Emulation domain commands.
Implementations§
Source§impl EmulationClient
impl EmulationClient
Sourcepub async fn can_emulate(
&self,
session_id: Option<&str>,
) -> Result<CanEmulateReturns, CdpError>
pub async fn can_emulate( &self, session_id: Option<&str>, ) -> Result<CanEmulateReturns, CdpError>
Tells whether emulation is supported.
Sourcepub async fn clear_device_metrics_override(
&self,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn clear_device_metrics_override( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>
Clears the overridden device metrics.
Sourcepub async fn clear_geolocation_override(
&self,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn clear_geolocation_override( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>
Clears the overridden Geolocation Position and Error.
Sourcepub async fn reset_page_scale_factor(
&self,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn reset_page_scale_factor( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>
Requests that page scale factor is reset to initial values.
Sourcepub async fn set_focus_emulation_enabled(
&self,
params: SetFocusEmulationEnabledParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_focus_emulation_enabled( &self, params: SetFocusEmulationEnabledParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Enables or disables simulating a focused and active page.
Sourcepub async fn set_auto_dark_mode_override(
&self,
params: SetAutoDarkModeOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_auto_dark_mode_override( &self, params: SetAutoDarkModeOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Automatically render all web contents using a dark theme.
Sourcepub async fn set_cpu_throttling_rate(
&self,
params: SetCpuThrottlingRateParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_cpu_throttling_rate( &self, params: SetCpuThrottlingRateParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Enables CPU throttling to emulate slow CPUs.
Sourcepub async fn set_default_background_color_override(
&self,
params: SetDefaultBackgroundColorOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_default_background_color_override( &self, params: SetDefaultBackgroundColorOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.
Sourcepub async fn set_safe_area_insets_override(
&self,
params: SetSafeAreaInsetsOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_safe_area_insets_override( &self, params: SetSafeAreaInsetsOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
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.
Sourcepub async fn set_device_metrics_override(
&self,
params: SetDeviceMetricsOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_device_metrics_override( &self, params: SetDeviceMetricsOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
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).
Sourcepub async fn set_device_posture_override(
&self,
params: SetDevicePostureOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_device_posture_override( &self, params: SetDevicePostureOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Start reporting the given posture value to the Device Posture API. This override can also be set in setDeviceMetricsOverride().
Sourcepub async fn clear_device_posture_override(
&self,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn clear_device_posture_override( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>
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.
Sourcepub async fn set_display_features_override(
&self,
params: SetDisplayFeaturesOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_display_features_override( &self, params: SetDisplayFeaturesOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Start using the given display features to pupulate the Viewport Segments API. This override can also be set in setDeviceMetricsOverride().
Sourcepub async fn clear_display_features_override(
&self,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn clear_display_features_override( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>
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.
pub async fn set_emit_touch_events_for_mouse( &self, params: SetEmitTouchEventsForMouseParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Sourcepub async fn set_emulated_media(
&self,
params: SetEmulatedMediaParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_emulated_media( &self, params: SetEmulatedMediaParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Emulates the given media type or media feature for CSS media queries.
Sourcepub async fn set_emulated_vision_deficiency(
&self,
params: SetEmulatedVisionDeficiencyParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_emulated_vision_deficiency( &self, params: SetEmulatedVisionDeficiencyParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Emulates the given vision deficiency.
Sourcepub async fn set_emulated_os_text_scale(
&self,
params: SetEmulatedOsTextScaleParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_emulated_os_text_scale( &self, params: SetEmulatedOsTextScaleParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Emulates the given OS text scale.
Sourcepub async fn set_geolocation_override(
&self,
params: SetGeolocationOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_geolocation_override( &self, params: SetGeolocationOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Overrides the Geolocation Position or Error. Omitting latitude, longitude or accuracy emulates position unavailable.
pub async fn get_overridden_sensor_information( &self, params: GetOverriddenSensorInformationParams, session_id: Option<&str>, ) -> Result<GetOverriddenSensorInformationReturns, CdpError>
Sourcepub async fn set_sensor_override_enabled(
&self,
params: SetSensorOverrideEnabledParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_sensor_override_enabled( &self, params: SetSensorOverrideEnabledParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
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.
Sourcepub async fn set_sensor_override_readings(
&self,
params: SetSensorOverrideReadingsParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_sensor_override_readings( &self, params: SetSensorOverrideReadingsParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Updates the sensor readings reported by a sensor type previously overridden by setSensorOverrideEnabled.
Sourcepub async fn set_pressure_source_override_enabled(
&self,
params: SetPressureSourceOverrideEnabledParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_pressure_source_override_enabled( &self, params: SetPressureSourceOverrideEnabledParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
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.
Sourcepub async fn set_pressure_state_override(
&self,
params: SetPressureStateOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_pressure_state_override( &self, params: SetPressureStateOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
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.
Sourcepub async fn set_pressure_data_override(
&self,
params: SetPressureDataOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_pressure_data_override( &self, params: SetPressureDataOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
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.
Sourcepub async fn set_idle_override(
&self,
params: SetIdleOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_idle_override( &self, params: SetIdleOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Overrides the Idle state.
Sourcepub async fn clear_idle_override(
&self,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn clear_idle_override( &self, session_id: Option<&str>, ) -> Result<Value, CdpError>
Clears Idle state overrides.
Overrides value returned by the javascript navigator object.
Sourcepub async fn set_page_scale_factor(
&self,
params: SetPageScaleFactorParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_page_scale_factor( &self, params: SetPageScaleFactorParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Sets a specified page scale factor.
Sourcepub async fn set_script_execution_disabled(
&self,
params: SetScriptExecutionDisabledParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_script_execution_disabled( &self, params: SetScriptExecutionDisabledParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Switches script execution in the page.
Sourcepub async fn set_touch_emulation_enabled(
&self,
params: SetTouchEmulationEnabledParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_touch_emulation_enabled( &self, params: SetTouchEmulationEnabledParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Enables touch on platforms which do not support them.
Sourcepub async fn set_virtual_time_policy(
&self,
params: SetVirtualTimePolicyParams,
session_id: Option<&str>,
) -> Result<SetVirtualTimePolicyReturns, CdpError>
pub async fn set_virtual_time_policy( &self, params: SetVirtualTimePolicyParams, session_id: Option<&str>, ) -> Result<SetVirtualTimePolicyReturns, CdpError>
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.
Sourcepub async fn set_locale_override(
&self,
params: SetLocaleOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_locale_override( &self, params: SetLocaleOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Overrides default host system locale with the specified one.
Sourcepub async fn set_timezone_override(
&self,
params: SetTimezoneOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_timezone_override( &self, params: SetTimezoneOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Overrides default host system timezone with the specified one.
Sourcepub async fn set_visible_size(
&self,
params: SetVisibleSizeParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_visible_size( &self, params: SetVisibleSizeParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Resizes the frame/viewport of the page. Note that this does not affect the frame’s container (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported on Android.
pub async fn set_disabled_image_types( &self, params: SetDisabledImageTypesParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Sourcepub async fn set_data_saver_override(
&self,
params: SetDataSaverOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_data_saver_override( &self, params: SetDataSaverOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Override the value of navigator.connection.saveData
pub async fn set_hardware_concurrency_override( &self, params: SetHardwareConcurrencyOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Sourcepub async fn set_user_agent_override(
&self,
params: SetUserAgentOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_user_agent_override( &self, params: SetUserAgentOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Allows overriding user agent with the given string.
userAgentMetadata must be set for Client Hint headers to be sent.
Sourcepub async fn set_automation_override(
&self,
params: SetAutomationOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_automation_override( &self, params: SetAutomationOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Allows overriding the automation flag.
Sourcepub async fn set_small_viewport_height_difference_override(
&self,
params: SetSmallViewportHeightDifferenceOverrideParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn set_small_viewport_height_difference_override( &self, params: SetSmallViewportHeightDifferenceOverrideParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
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.
Sourcepub async fn get_screen_infos(
&self,
session_id: Option<&str>,
) -> Result<GetScreenInfosReturns, CdpError>
pub async fn get_screen_infos( &self, session_id: Option<&str>, ) -> Result<GetScreenInfosReturns, CdpError>
Returns device’s screen configuration.
Sourcepub async fn add_screen(
&self,
params: AddScreenParams,
session_id: Option<&str>,
) -> Result<AddScreenReturns, CdpError>
pub async fn add_screen( &self, params: AddScreenParams, session_id: Option<&str>, ) -> Result<AddScreenReturns, CdpError>
Add a new screen to the device. Only supported in headless mode.
Sourcepub async fn remove_screen(
&self,
params: RemoveScreenParams,
session_id: Option<&str>,
) -> Result<Value, CdpError>
pub async fn remove_screen( &self, params: RemoveScreenParams, session_id: Option<&str>, ) -> Result<Value, CdpError>
Remove screen from the device. Only supported in headless mode.