Take screenshot on error

Hello,

I would like to take a screenshot of the ENTIRE screen when an error occurs.

Currently i have in my catch,
take screenshot
save image
send outllok message

The question is, what do I do to take a screenshot of the whole screen when an error occurs because the selectors would change each time

1 Like

You can send hot key @mzucker

you already got the answer buddy
–make sure that the whole process inside the TRY Block and if any error occurs it will go to CATCH block
–here we need to do some workarounds like
if we are working on same window or browser through out the sequence which is mentioned in the TRY block then get the output variable from that attach window activity from property APPLICATIONWINDOW which is a window variable

–now coming back to the catch block, use a attach window activity and pass that window variable as input to the property WINDOW.
–within this attach window we can simply use a TAKE SCREENSHOT activity with no selector or element captured (as we have mentioned the attachwindow)
–this will take the screenshot and get us a image variable as output

–then we need to use a SAVE IMAGE activity and pass the above variable as iput and mention the file path where we want to save the image
–then use a send mail activity and in the ATTACH FILE property mention the file path of the image and it would send that image file as a attachment to the person mentioned

thats all you are done
hope this would help you
kindly try this and let know for any queries or clarification
Cheers @mzucker

Hello @mzucker

Don’t pass any selectors for take screenshot activity automatically it will capture the entire screen.

TakeScreenshot.xaml (8.6 KB)

Regards
Ajay

Hi palaniyappan, thanks for all the helpful advice.
Only one problem, what if we are using dozens of windows, is there any way to simply get the active window?
Alternatively does not passing any selectors cover this issue?

1 Like

Great
thats a good question
for each attach window, inside it use a assign activity and create a window variable and save the output of the attach window activity
–that is that assign activity should be placed as a first activity in the attachwindow do container
–similarly in all attachwindow activity with same variable name so that when it enters into each window that variable will be assigned with that value
–if any exception occurs now we will be directed to catch block, were we can use that variable in attachwindow and use take screenshot
–as that variable is now assigned with its corresponding attachwindow window output variable that will get reflected here in the catch block as well

simple isnt it
hope this would help you
Cheers @mzucker

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.