Take screenshot of UI at the time of failure

Class library usage, coding and language questions.
Posts: 19
Joined: Sat Feb 13, 2016 5:04 pm

Take screenshot of UI at the time of failure

Post by deepak1920 » Wed Sep 14, 2016 12:42 pm


I am using ranorex API in my visual studio solution. Whenever something goes wrong, test script is failed and in report I can see the failure reason. I want to know the state of UI at the time of failure.

Is it possible to enable some settings through code which will capture the screenshot whenever any failure/error takes place?

I know ranorex api has one method - Report.Screenshot(). But I have to call it at all places wherever I feel the error can occur. It will not cover all the scenarios as I am not aware, in future at which all places error can occur?

Deepak Gupta

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Take screenshot of UI at the time of failure

Post by Support Team » Fri Sep 16, 2016 12:33 pm

Hi Deepak,

Taking screenshots in case of an error is an Test Suite feature. Since you are not using a Test Suite, you would need to create your own error handling. This could be done by using Report.Screenshot within a try-catch block.

I hope this information helps you solving your intention.

Markus (S)