Reputation: 51
I am trying to use the function screenshot in XCTest to capture a screen, but I am unable to understand how to save this screenshot on to a simulator device or physical device
https://developer.apple.com/documentation/xctest/xcuiscreenshot
I am trying to Automate UI testing here and will need to capture a lot of screenshots for review.
Upvotes: 5
Views: 3172
Reputation: 3926
Take a look on this. Download the source and import the needed stuffs into your code.
Its very simple to take screenshots while running UI tests. Just call saveScreenshot(path)
method to take and save screenshots in desired path.
Upvotes: 1
Reputation: 105
On the object XCUIScreenshot
you have a property image
using it you can retrieve and save the screenshot wherever you want.
To save the image you can see this topic : How to save picture to iPhone photo library?
Upvotes: 1