rticau / ScreenCapLibrary

Robot Framework test library for capturing screenshots and video recording.
Apache License 2.0
40 stars 15 forks source link

Black screen screenshot/video #64

Open fengnex opened 3 years ago

fengnex commented 3 years ago

General information:

Only when we open the remote RDP desktop, the recoreded screen/video is OK, and both will be black screen at any other time. Any idea on how to fix the problem?

The test server has no a monitor.

fengnex commented 3 years ago

We use Seleniumlibrary to test a web application and this library can always correctly capture an image when any test fails, even though ScreenCapLibrary got a black screen, so what I suggest is that ScreenCapLibrary can utilize a similar way with that of Seleniumlibrary to ensure the recorded gif is OK, which I believe will mitigate the problem at least.

I mean, ScreenCapLibrary can also capture a series of pictures in a way that is similar to that of Seleniumlibrary in the test process and generate the required gif picture at last. What I think now is that this solution may be able to avoid the black screen problem.

@cristii006 Would you be so kind as to talk about your opinions about the above suggestion?

fengnex commented 3 years ago

@cristii006 This is not a duplicate of #24 because we do not use the headerless mode and the platform we are using is windows 10. I have actually read the post of #24 before posting this one.

However, we met a similar problem when trying to capture the screen with ffmpeg, and in that case, ffmpeg does not generate a file either. I'm still not clear about the relevant root cause and am guessing it is something related to Windows OS.

cristii006 commented 3 years ago

@fengnex I see, my bad I will remove the label, can you provide any additional details that can help us reproduce the error?

fengnex commented 3 years ago

I checked relevant logs and found no errors or warnings.

We run an RF script on a remote Windows 10 that has no monitor connected physically, and the captured video/gif is OK ONLY when the RDP window is open, but the result video/gif will be a black screen once the RDP window is closed.

We verified one example: after ScreenCapLibrary started its capture process for a while but with no opened RDP window and then we opened an RDP window, from then on the result video/gif was correct, although it was all black screen before that occasion. Maybe this could help to reproduce the problem.

ScreenCapLibrary seems pretty mature and wonderful, and I hope it will be better and develop quickly. Thanks!

cristii006 commented 3 years ago

Hello @fengnex,

This is currently a limitation of ScreenCapLibrary that is coming from mss that is described here. As @mihaiparvu described in #24 an alternative would be the usage of VNC Server, in order to solve your problem.

Best regards, Cristi

fengnex commented 3 years ago

The following way recommended by https://superuser.com/questions/1288469/remote-windows-server-virtual-machine-always-keep-desktop-open-simulate-rdp-se# cannot work on windows server 2019, which has been confirmed: In the Registry, navigate to the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon As necessary, create and populate the following values. They are all of type REG_SZ (String):

Value Data Example


AutoAdminLogon 1 1 DefaultDomainName CONTOSO DefaultUserName JohnDoe DefaultPassword P@ssw0rd!