Black screen when taking screenshot with Internet Explorer driver on Windows build server Black screen when taking screenshot with Internet Explorer driver on Windows build server selenium selenium

Black screen when taking screenshot with Internet Explorer driver on Windows build server


This is the default behavior of Windows. since Internet Explorer is tightly coupled with Windows, it behaves this way but other browsers don't.

In order to have better resource utilization, when running on remote, windows detects that since session is running in remote mode and nobody is watching the screen, it takes away the resources required to show the screen and screen goes black. When you log into the machine, resources to show screen UI are deployed again.Hence, when running in remote mode, since there is no screen being showed, screenshot comes out to be blank.

There are only workarounds, no solution.Workaround:

Workaround 1: Use VNC server for your remote session instead of RDP since VNC keeps the remote session alive.Workaround 2: Add this command to batch file : tscon rdp-tcp#1 /dest:console

It will switch the session to "1" which is active mode. By default it will be running on "0" mode. It will disconnect your session and now you can run your test case.