I reproduced your problem.
It seems you try to take a screenshot in RDC (remote desktop connection)
It works fine if session is opened and not locked.
BUT if you lock the session it takes a snapshot of
lock screen
If you disconnect the remote session the task get error
"Handle is invalid"
Code: Select all
....
I: 15.02.2019 12:51:15: Executing "5.Screenshot"
E: 15.02.2019 12:51:15: The handle is invalid.: CaptureScreen failure
E: 15.02.2019 12:51:15: An error occurred. Step #5 (Screenshot).
E: 15.02.2019 12:51:15: Task execution is aborted
this error is not appear in local console, because local console is always connected. But you will get the screenshot of your lock-screen
You have to take a snapshot from the window, because the window always alive in the session.
BUT (again) Internet Explorer sometimes gives an empty screenshot.
You can take snapshot twice.
take snapshot, wait 1 sec and take snapshot again. Second screenshot always corrected
I tried this on RDC, with locked session and in disconnected session. It works.
Unfortunately other browsers (Chrome, FireFox) always gives empty screenshot
I will send the corrected example to you