Could not capture screenshot when test failed on windows


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


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


turn on auto logon for windows


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


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 *