screenshot()
Takes a screenshot of a screen or UI element’s current visual state.
Declaration
func screenshot() -> XCUIScreenshotDiscussion
The output of this method is equivalent to capturing a screenshot manually on a device. For example, if you take a screenshot of a window on macOS that is covered by another window, the covering window is visible in the screenshot.