How to close Background image

Delete File: The process cannot access the file ‘C:\Users.…\Documents\UiPath\Read Image Text\screenshot.png’ because it is being used by another process.

@Yoichi @Anil_G @supermanPunch

Hi Manjunatha,

Check this link once. They were also facing the similar issue, might be helpful for you.

Can't delete png.file because it is in use by other processes.

Hey @Pujari_Manjunatha

Have seen this a few times:
Can you try this:
Method one is Collect.
Method two is WaitForPendingFinalizers

That would help you.

Happy Automation!


What are these “Collect”, and " WaitForPendingFinalizers" How can I define them?

You need to just use Invoke Method Activity and in there Browse For Types in TargetType, “System GC”

these are 2 methods which would collect Garbage memory and suspend any action until the current thread has completed collection of objects.


@nagini.pragna @adiijaiin

Same error,


Can you share how you saved this png file?




In the scenario I am doing, I just want to take a screenshot of anything, then read the text from the image, and finally, I need to close it.


For now, can you try the following step?

First, right click the TakeScreenshot and choose “Extract as Workflow”


Next, turn on Isolated property of the InvokeWorkflow file activity.
In created xaml file, add UiPath.Core.UiElement type argument (Let’s say in_uie).
Add UseApplicationBrowser activity and set in_uie at InputElement, Never at Open and Close property, as the following. Save the xaml file.

In original xaml file, create UiElement type variable (Let’s say uie) and set it at Output property of UseApplication/Browser activity. And set it at Arguments of the InvokeWorkflowfile activity.

Finally, run the workflow.


You don’t need to save it as an image to read the text from it. Just use the OCR activities.

All OCR Activities required Input image type only, right?

No, you can give them a selector. They get the image themselves.


in_uie seems null. Can you check if UiElement is passed correctly?



Is the following uie set at Output property of UseApplciation/Browser activity?
And also check content of in_uie at Locals panel when error occurs.


It null value


Can you set uie at Output element property of UseApplicationBrowser activity in the original xaml file?



Getting same error