Skip to main content

Coded UI Tests: Automatically take screenshots while running your tests

One of the nice things that you can do while running your Coded UI tests, is capturing screenshots of the executed actions.

Doing this is easy, to capture a screenshot of the whole screen, execute the following code:

If you only want to take a screenshot of a specific UI element, call the CaptureImage method on the element: