Could not capture screenshot when test failed on windows

Problems:

We have configured to capture screenshot when selenium (or any web based automation test, e.g. web driver, sahi, etc… ) tests failed, but each time we got is a blank image which only has a black background. The CI agent runs on Windows 2008 in a virtual machine

blank black ground image

Reason:

There is no any real window opened because nobody logged on this machine, so the captured image is only a blank image. The solution is turn on auto logon for windows and never lock the desktop

Solution:

turn on auto logon for windows

References:
http://support.microsoft.com/kb/324737
http://answers.microsoft.com/en-us/windows/forum/windows_7-security/how-to-turn-on-automatic-logon-in-windows-7/99d4fe75-3f22-499b-85fc-c7a2c4f728af

Based on the above posts, the manual steps are:
run command: control userpasswords2
Select the account from the list, uncheck the “Users must enter a user name and password to use this computer. ” and apply

You can also edit the registry, and the steps can be applied to multiple machines using psexec in this way, but I didn’t try that.

never lock the desktop

References:
http://social.technet.microsoft.com/Forums/en-US/winservergen/thread/520a8128-7e9d-4983-89d2-f414a6ec8188/

The manual steps are:

  1. Right click on desktop, select Personalization
  2. Select Screen Saver,
  3. Clear the check box “On resume, display logon screen”.

Leave a Reply

Your email address will not be published. Required fields are marked *