UiPath Community Edition Take screenshot activity failing on Virtual Machine

Take screenshot activity works properly on local machine, but fails when using an unattended robot on virtual machine (AWS EC2) with following error:

Take Screenshot: System.ComponentModel.Win32Exception (0x80004005): The handle is invalid at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation) at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation) at UiPath.Vision.UiImage.FromScreenRegion(Rectangle region) at UiPath.Core.Image…ctor(Region screenRegion)

I have tried logging out from RDP access as well but then the job is not executed and stays in pending state.
I have tried UiPath.UiAutomationNext.Activities.NTakeScreenshot but that does not update the file on disk, when I try to use mail activity to mail the screenshot I get Old screenshot image.

Hello @Ravendra_Singh ,

I found this post about your issue, maybe you can find something useful:


Do one thing bro please go to this url %userprofile%.nuget\packages in the virtual machine

Then please check in the project folder and keep on clicking until you get the project then you just debug it and if the bot is not take screenshot then you debug it you will get the solution may be

and what am thinking is its a selector problem may be i am not sure but try once
I hope it was a selector problem please check

If you get solution mark it as solved

Chethan p

Thanks, @wasea . I guess this is the issue. Taking screenshot on a virtual machine using community version is not possible.

Thanks, for helping out @copy_writes . But I don’t think anything is wrong with the selectors, I am passing the output element of use browser activity for screenshot. Same script runs perfectly on local machine. And yes I went into the project folder, but I don’t see any screenshot taken.

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