Unable to take screenshot when instance is locked

Hello team/ @monsieurrahul
i am unable to take the screenshot when the instance is locke or minimised.Getting the below error.

Error Source: Take Screenshot ‘DIV page-login’>>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)
Error Info: UiPath.Core.ImageOperationException
Need immediate assistance.
Thanks in advance

Hello @Satya_Kishore :wave:

Can you please share your workflow?

We are uisng EC2 instance and we are running an unattended bot, also were are taking screenshots of the web page in case of login fails.

Hoping you have used the Take Screenshot activity and saved it using Save Image activity? Maybe if you could share a screenshot of your workflow, I could understand what’s going wrong.


If your goal is to take screenshot of the whole page, simply use the activity followed by a save image activity to save the image, don’t use or manipulate the selectors.

Still it is throwing the same error. We are running this by minimizing the EC2 instance

Still it should not throw an error right? It should have been saved to the specified folder.

Maybe the below thread could help you:

It is not trowing error at save image Activity, throwing error on Take screenshot activity

Did you refer this link?