Skip to content

API Reference / @gtkx/testing / screenshot

Function: screenshot() ​

screenshot(target, options?): Promise<ScreenshotResult>

Defined in: packages/testing/src/screenshot.ts:345

Captures a widget as PNG, retrying until it has a paintable size. Writes to options.path when supplied, creating missing parent directories.

Parameters ​

target ​

Accessible

Widget to capture.

options? ​

ScreenshotOptions

Scale, timeout, retry interval, and output path.

Returns ​

Promise<ScreenshotResult>

Base64-encoded PNG data, MIME type, and dimensions.

Remarks ​

Open popovers are composited at their on-screen positions. If the display has not presented a frame, captures widget contents directly instead of using GTK's cached render node. If that also fails, the error identifies the display's presentation failure.