ScreenCapLibrary+Azure VM black screen

Is it possible to use ScreenCapLibrary when running test in Azure VM ?

When I am connected to VM, it works fine and video is embedded to report but when running the test in the night, only black screen is shown.

Is there some way to make it work in nightly runs?

Hi Pete,

The key to making it work will be identifying the differences between running when you are connected and the nightly run.

Azure VM - is Windows or Linux?

And how do you connect? via a GUI enthronement, RDP, VNC, something similar?

And how does the nightly run connect? ssh?

The reason I ask these questions is ScreenCapLibrary is probably expecting a desktop environment and depending on how you connect it may not know how to find the desktop or even depending on what the nightly runs do there may not even be a desktop environment to take a screen shot of.

As an alternate though process, you mentioned

Is this report a web page? is the test being run with Browser Library or SeleniumLibrary? if so why use ScreenCapLibrary and not use their screenshot keyword?


Hi Dave. Thank you for your answer.

  • Azure VM - is Windows
  • RDP connection and then everything works fine
  • My test are run with Task Scheduler
    (I would like to use Jenkins to control test running. I think there is a way to do this with Azure VM but this is an another question)
  • SUT is browser based & DB & API. I use Selenium

So the problem is that I would like to have a video of the test run with failed cases

I only have used ScreenCapLibrary (I like it. Easy to use and working fine when I run tests “manually” with RDP connection)

Is there some other way to have a video with failed test run with my setup?

Ah this is likely where the issue is, it’s probably related to the user account and other security settings on your scheduled task.

I don’t have a windows machine here at the moment, so I grabbed an example screen shot of the security settings

You may need to change the user account to your account and make sure it says “Run only when user is logged in” so the scheduled task runs on your desktop, otherwise the ScreenCapLibrary is probably just recording the login screen.

I don’t think either SeleniumLibrary or Browser Library can record video. so it seems ScreenCapLibrary is a good choice.

To make sure the scheduled task can run with the “Run only when user is logged in”, login to the RDP session and then disconnect (don’t log off), hopefully there’s no group policy to log off disconnected sessions :crossed_fingers: .

Hope that sorts it out for you,


Hi Dave,

Yes, you were correct. When I do disconnect, the recording does not success.
Thanks to you, now I know were the “problems” is and can investigate, if I can do something about it.

1 Like

Hi Pete,

Some companies have a policy that forces logout when you disconnect, usually there is a grace period of 5-30 minutes but some it’s immediate.

Ideally you want a policy that doesn’t ever log you off, but even a policy that allows you to remain logged in for up to a week is more workable.

Another way to handle it is to enable automatic logon, (system admins usually hate this option)

Yet another way would be, instead of using a scheduled task, put the robot command in the startup options, then from another machine schedule a task to create a RDP connection to that machine, when the rdp session opens and logs on robot will run, you can then use the shutdown command to schedule a log off after 5 minutes in the suite tear down. the big issue with this is when you login to the machine during the day the test will also run (not ideal but a potential workaround)

Hopefully that will give you some ideas,