Cannot delete screenshot because it is used by process

Hello everybody,

I have the following scenario:.
Robot 1 does some stuff and then at some point it takes a screenshot and saves it locally. Once robot 1 is finished with its queue item it goes on to the next ones if there are more, so the process can still be running. But it also creates a queue item for robot 2, who has now started uploading some files - including the screenshot that was created by robot 1.
After uploading the screenshots robot 2 tries to delete the files. This error message appears:
System exception.File deletion was not successful: “The process cannot access the file ‘screenshot.png’ because it is being used by another process”

But Robot 1 does not actually use the files, it merely created the screenshots.
Do you have any tips ?

Hi @Stainless22

Before the going to that Step use Kill process activity to close all the Imges by the robot.

You can keep the unique name for all the SS something like this : "Screenshot_"+Now.ToString("_ddMMyyy_HHmmss")+".png"