Save Image Failed while running inside loop

Hi guys!
My steps:

  1. Take screenshot activity to capture the screenshot.
  2. Save image activity to save the image.
  3. Send email activity to send the screenshot as an attachment.

Note: When ever i am running the artifact, for the first loop it is performing correctly. But when it executes for the second time inside the same loop, i am getting this following error.

UiPath.Core.ImageOperationException: Save image failed. Check if the file name is a valid path —> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.

I have tried many times but it is throwing the same error.

Please help me out how to handle this situation.

Regards,
Jiban

Hi,
All looks fine.:slight_smile:
Could you please attach workflow.

Thanks for your response @ddpadil
Sorry, i cannot attach the workflow here.
Let me know which activity and properties you need to check so that i can provide the screenshot.

Thanks,
Jiban

Take Screen shot and save image activities.
can’t analyse much by screenshots. :frowning:

Hi guys!
My steps:

Take screenshot activity to capture the screenshot.
Save image activity to save the image.
Send email activity to send the screenshot as an attachment.
Note: When ever i am running the artifact, for the first loop it is performing correctly. But when it executes for the second time inside the same loop, i am getting this following error.

UiPath.Core.ImageOperationException: Save image failed. Check if the file name is a valid path —> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.

I have tried many times but it is throwing the same error.

Please help me out how to handle this situation.

what studio version do you use?

Please save the file with a different name each time. May be you can add date and time. And add 2 seconds delay before sending email, if it is immediately next activity.
It happens because of the file being used by a process.
Let me know, if it works.
Thanks.

Hi,I had the same problem in my own process. I have a do - while loop in which I take a screenshot of a webpage, save the image, click next to go to the next image, and repeat to take a screen shot of each page. However, after the first screenshot saves ok, each subsequent one fails, I can see the image is null each time. Jus wondering if anyone found a solution to this problem