capture

suspend fun Device.capture(timeout: Duration = 30.seconds): Capture(source)

Takes a screenshot, the hierarchy, the device info and the driver log at once, each within timeout, and returns them as one Capture. Device failures never escape: a part that fails or runs out of time is null in the result, with its cause in Capture.failures. Only the caller's own cancellation propagates. Use it wherever a test wants evidence (after a step, in a catch); the JUnit extension and the pytest plugin call it for every failed test.