Synopsis¶
GUI Automation on Windows requires an available "display" in most cases. The "display" is where the desktop and applications can be seen.
The physical monitor/display attached to the computer is usually used to view the "display".
However, there are a number of cases when the display becomes unavailable:
While a screensaver is active.
While the physical display is powered off due to power saving.
After an RDP (Remote Desktop) connection has been established and the RDP client has been minimized or disconnected/quit.
While the desktop is locked.
Other reasons for no display being available:
Application being started from a Windows service (directly or indirectly).
Application being started from the Task Scheduler (because that is also a Windows service).
See Automation on Windows for more information and recommended setup steps to avoid this type of problem.
Symptoms¶
Screenshots are all black, all white or show some distorted image or random content.
Test script runtime errors because objects cannot be found.
Test script runtime errors because application does not respond to Squish anymore.
Squish script commands hang indefinitely.
Detecting lack of a Display¶
Python¶
Step 1: Copy
display_available.exe
into SQUISH_DIR\bin
or into any of the folders in the PATH
environment variable.
Step 2: Invoke display_available.exe
on the system where the squishserver is running:
Example log entry when the display is not available:
WARNING:
Disconnected RDP (Remote Desktop Protocol/Client)
session found.
This is usually caused by connecting and then
disconnecting (or minimizing) an RDP client to a
(Windows) computer. Once disconnected or minimized
the user session the lacks a display.
Lack of a display causes these general problems for
any GUI automation on Windows:
1) Applications cannot render their GUI.
Without rendering the coordinates of GUI elements
on the screen cannot be determined. These
coordinates are required for many mouse based
interactions with applications.
2) Sending "Window Messages" is paused or hangs.
Among others, sending Window Messages is required
for querying the current GUI controls of
applications.
To restore the display, log in to the physical console
(or to a VNC server running as a Windows service, if
one is installed).
Display not available (Reasons: (Typically) Disconnected RDP session or minimized RDP client.)