Verify Expression - TakeScreenshotIfFailed - Where are the screenshots stored?

I’ve set this to true. Where are the screenshots being stored?

1 Like

Can you check:

at the section screenshot paths?

1 Like

Like this? I’m still not seeing any verify screenshots stored there unfortunately

Also how do we take screenshots in a Mobile Test Project? With UiPath.MobileAutomation.Activities package there’s an option to Take Screenshot and save it to a variable but there’s no Save Image Activity :thinking:

If you debug and inspect the variable you’d see that the variable is of type Image.

You can then use the following C# snippet by using an Ivoke code activity to save the image in any format you want.

img.Save("image.png", System.Drawing.Imaging.ImageFormat.Png);


img is an argument to the Invoke code activity. I’m saving the image to the myImage variable and then passing this through the argument img to the Invoke code activity.

may we ask you to confirm that requested Activity:

and mentioned activity:

are the same?

No, they are not the same.

The thread started from UiPath.Testing.Activities.VerifyExpression which has a screenshot aspect but AFAIK it is in the context of reporting that to Orchestrator and storing it in the run logs of the test.

Then @trilogen specifically asked about the Screenshot activity from “UiPath.MobileAutomation.Activities package” which is what I replied to.

Perfect, now it is sorted out

Thank you, I ran your suggestion without error but I’m not sure where it saved. I’m going to run by you what I did and where I perhaps went wrong or haven’t done.

I stored my TakeScreenshot activity in myImage variable

I created Invoke code and pasted your code in

I then went in Arguments and assigned the myImage variable to img

In my Project Settings I’ve set my screenshot path in my documents

However no png file has been created there

I went and added the full path in the Invoke code. It now saves :partying_face:

When you don’t give a full path, then the projects directory path is used. Just refresh the project folder and you should see your png there (see image highlights in red).

Do you know how I can add the device name when saving image? Is there a uipath variable for it?
For example:

img.Save(CurrentDeviceWeAreConnectingToVariableName"-image.png", System.Drawing.Imaging.ImageFormat.Png);

You can save the connection to a variable and then reuse it on another connection (see Mobile Test Automation : App gets installed for every test case execution for more details on connection re-using)

After you have that variable, you should have the device name, app and other informations about the connection, saved on that variable.

In the settings,
Keep Screenshots - Run value and Debug value should be True
Screenshot Path - - Run value and Debug value should have Full folder path.

in the Activity Properties set both TakeScreenshotIfFailed & TakeScreenshotIfFailed as True

Now run/debug and check screenshot folder for screenshots.


Rahul Sihag

How do you upload the same screenshot to test manager, so it can be seen in the execution report. Thanks!

1 Like