Skip to content

buildDeviceMetricsOverride

Builds the Emulation.setDeviceMetricsOverride payload that pins a desktop capture to an exact pixel size.

Takes only the size half of CaptureScreenshotParams — routing the capture to a window is the transport’s job, not the payload’s.

Import:

import { buildDeviceMetricsOverride } from 'obsidian-integration-testing';

Signature:

function buildDeviceMetricsOverride(params: { readonly heightInPixels?: number; readonly widthInPixels?: number; }): Record<string, unknown> | undefined

Parameters:

ParameterTypeDescription
params{ readonly heightInPixels?: number; readonly widthInPixels?: number; }The requested capture size.

Returns: Record<string, unknown> | undefined — The CDP payload, or undefined when no size was requested (capture the window as it is).