screenshot

suspend fun screenshot(path: String)

Captures a screenshot of the current application screen and saves it as a PNG to path.

Primary canonical method for taking screenshots.

Platform Screen Capture Mechanics

  • Desktop JVM: Captures the active window frame bounds.

  • WasmJs: Playwright captures the viewport canvas.

  • Android: Triggers a device screenshot via UiAutomator / ADB screencap.

  • iOS: Triggers a simulator screenshot via xcrun simctl.

Example Usage

screenshot("build/reports/login-success.png")

Parameters

path

File path where the screenshot PNG will be stored.

See also