Wednesday, 30 September 2015

Disable Lock Screen on Windows 8.1 to Prevent - Automation engine is unable to playback the test because it is not able to interact with the desktop.

You might run into below error with automated testing with lab environments.
*******************************************************************************************************Error calling Initialization method for test class xxxxxxxx: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: Automation engine is unable to playback the test because it is not able to interact with the desktop.  This could happen if the computer running the test is locked or it’s remote session window is minimized.
*******************************************************************************************************

image
This could be because you have RDP to the test agent machine and you have logged out, minimized the RDP session. This can be prevented by repairing the lab environment and let it restart the test agent machine. Then as long as you do not RDP to test agent it should run automated tests without any issue.image
But if your test agent machine is Windows 8 or Windows 8.1 you might still run into the same error, even though you are 100% certain, that after repairing the lab environment, you have not RDP to the test agent machine.
This happens due to the lock screen functionality of Windows 8 and 8.1. to fix this issue disable the lock screen. This can be done in Group Policy Editor. Run gpedit.msc and set the “Do not display the lock screen” to “Enabled” sate.image
This will set the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Personalization with DWord “NoLockScreen” to value 1.image
More information on setting lock screen to disable, can be found here.

Disable the screen saver for Test Agent user.image
Set “Turn off the display” to never.image

In registry set the following DWord “DisableLockWorkstation”. Instructions here.image

More instructions in the answer here. Set and verify all of them.

Repair the lab environment again to make sure the restart of the test agent and, as long as no RDP sessions to the test agent machine, automated test will not run into “Automation engine is unable to playback the test because it is not able to interact with the desktop”.

image

No comments: