Attended robot gives error while screenshotting

Hello,
I have built a process that takes screenshots and it runs correctly on my environment and also from the Orchestrator.
When I try to run it from a VM in the Attended mode, it only works if I keep the VM open - if I close the VM or simply minimise it, it gives me an error:

System.ComponentModel.Win32Exception (6): 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.Vision.UiImage…ctor(Rectangle region, Int32 rotationDegree)
at UiPath.Core.Image…ctor(Region screenRegion)

at UiPath.Core.Activities.ObsoleteTaskAsyncCodeActivity`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Could anyone please help me understand what is going wrong with the attended process?
Thank you in advance!

@armi_v

Ideally you shpuld not be minimizing and running the unattended bot…ideal way is to let the bot login and run and close…as you kept the ui available it is connecting to that session but once you minimize or close it is not having the ui to interact that is the reason it is failing…either run completely with keeping it open or use unattended robot to completely run it

Cheers

Hi @armi_v

While using the attended mode the system must be logged-in and also the browser / application which we are using for automation should be opened because in attended mode most of the UI activities will run by coming into foreground and if any field is not been visible to bot then it will throw an error. While using attended mode make sure the VM is not closed or minimized.

Regards

1 Like

Thank you for your reply.

1 Like

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