Sahi Pro - Working with Minimised and Closed Remote Desktop Connections

Minimised Remote Desktop Connection


When tests are executed on a remote machine using Remote Desktop Connection and the RDC window remains minimised, native events (including taking screenshots) fail to work.

To fix this, one needs to add registry keys on the client machine from which the Remote Desktop Connection is made. NOTE that these keys are to be modified on the client and not the remote machine.

danger Please be careful while changing the registry entries.

  1. Launch the Windows Registry as appropriate on your Windows machine
  2. For 32-bit Windows, find the registry key:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Terminal Server Client

    For 64 bit Windows, find the registry key:
    HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Terminal Server Client
  3. Create a DWORD value with the name RemoteDesktop_SuppressWhenMinimized with value 2.
  4. Run the tests.
Now native events should work well with a minimised Remote Desktop Connection.

Closed Remote Desktop Connection

Sometimes users would want to open a Remote Desktop Connection, start running the tests on the remote machine, and close off the connection from the client while the tests are running.

In this case, native events (including taking screenshots) fail to work.

To work around this, please do the following instead of closing the remote desktop connection directly.
  1. Create a batch file on the Remote machine's Desktop (For example: "disconnect.bat").
  2. Type the following line in the file -

    tscon %sessionname% /dest:console

    and save it.
  3. Start off the tests on the Remote machine.
  4. Do not close the Remote Desktop Connection from the client directly.
  5. Instead, double click on the batch file. The session will be closed by the remote desktop.
Now native events should work well with the closed Remote Desktop Connection.