How to run remote headless GUI automation

18 Nov

I see quite a few posts about this, and so thought I’d share some tips.

Funny the people that ask about the issue never thought of or knew about this solution. Perhaps the prevalence of Windows OS with options for remote desktop (RDP) have made RDP the de facto standard for remote access to Windows computers, especially since the bulk of GUI automation is run on Windows. Sigh…one should be enlightened with the other remote access technologies.

Anyhow, back to topic at hand. The issue with RDP when running GUI automation is that most GUI automation tools require an active desktop. So when you log out of RDP or lock the computer, automation is paused/stuck until you reconnect. Very bad. How to workaround this?

You need a way for the remote machine to have it’s head/desktop be unlocked and active. And the best way to do this that I know of and always use is the VNC protocol rather than RDP. There are numerous VNC software (server and client) available that are also free and/or open source. For Windows, you can use RealVNC, TightVNC, UltraVNC (the free versions are good enough, unless you need encrypted remote access, but we normally run automation within the LAN or via VPN anyways). For Windows 7, Vista, and 2008, you may need to use TightVNC or UltraVNC due to Windows UAC, which some clients like free RealVNC may not support.

Install VNC server on the Windows host machine that runs the GUI automation. Connect to said machine using VNC client (typically can be portable app, doesn’t need install, if you have the standalone executable).

Log in and keep logged in to desktop via VNC, run your automation, then disconnect VNC. Or you may opt to keep VNC client open to monitor progress. Even with VNC client closed, because it is simply a relay of the host’s screen to your desktop (works differently than RDP), when disconnected, it just stops relaying is all. And the relay works like a splitter connection, both the local head/monitor has access, and the VNC client has access, unlike with RDP where if you connect remotely, you lock the desktop on the head. Or with server OS versions, you connect separately via a separate desktop session that’s not shared with the head desktop. By this design VNC method will continue to run your automation even though you’re not connected over VNC, as long as the host desktop is logged in and not locked.

The only disadvantage of VNC is that when using it, it is somewhat slower than RDP because it’s not optimized for Windows unlike RDP.

VNC will work whether your host is a physical machine (regardless of whether you connect a monitor to it or not) or if it’s a virtual machine (VM). On VM, the head is simply a local connection to the VM via the VM software’s console. VNC will work as long as you have VNC server installed and networking to/from the host is working OK, and assuming Windows isn’t in a funky state.

In the case that automation can run even when desktop is locked, you can then use RDP as well, but need to connect as console or admin session (session 0). On end user desktop versions of Windows, you only get console session but on server versions, you get multiple session (i.e. like terminal server). If you use the other session on Windows server, on disconnect, your session stops and automation pauses.

FYI, I came across VNC because of my use of Windows during the early days (Windows 95, 98, 2000) back when remote desktop was only available on the server versions of Windows. So looked around for alternate solution and thus found VNC. Been useful since, even as a complement to normal RDP use.

Update 6/24/2013: nice to see a suggestion/recommendation to use VNC over remote desktop at the Selenium Conference 2013 (

Update 05/07/2014: I came across an interesting article today that can be helpful when corporate network policies are strict and you can’t disable things like auto-lock on idle and screensaver passwords, etc. Kind of related to remote desktop but not quite and an alternative to VNC approach or a complement to it when combined together:, <== looks like that URL has since been removed/down, but you may be able to find it via web archive / wayback machine. Here’s a similar article for same type of solution:

Update 09/29/2014: the following link is useful for Remote desktop and automation when minimizing remote desktop. Though I still prefer the 5/7/2014 solution overall: Running Tests in Minimized Remote Desktop Windows

4 Responses to “How to run remote headless GUI automation”

  1. Naghi January 3, 2012 at 7:11 pm #

    Awesome article. Thank you for putting it all together.

  2. Tom October 17, 2012 at 4:54 pm #

    Great article for situations where you have to have GUI programs running on servers. I’ve used this solution and it has worked well.

  3. Fabiano October 21, 2015 at 11:34 pm #

    Hi there !!!

    Would this work even if the GUI automation needs the mouse to click and/or drag things around ?

    • autumnator October 22, 2015 at 2:33 am #

      Yes, it should work. The desktop just needs to be “exposed” to the automation software, as described in the post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Sue Connelly's KIT List Blog

Job Search and Career Management Tips and Strategies

The Networker

Bassem Aly



xlcwu's Blog

Lifestyle, Computer, Ubuntu, Linux, Apple, Mac, iPhone, Game, Programming, Java, C, ObjC and More ...

Multiple States Knowledge Base

Multiple States is a digital design, development and content creation studio, specialising in beautiful, clean and functional websites with powerful content.

journey of quality

make it perfect!

Marc Guillemot's blog

Java, Groovy, HtmlUnit, WebTest, NekoHTML and more. Contact me for rates.

North American Sea Glass Association official website

NASGA is a non-profit organization positively supporting sea glass collectors and the sea glass community with festivals, information, educational opportunities, commercial membership and more. The primary goal of NASGA is to establish a community of informed collectors and sellers of sea glass that are educated on the characteristics and significance of genuine sea glass.

Abiral Shakya's Blog

Learning, Improving and Sharing

Tea in Eighteenth-Century Britain

History of Tea Project at Queen Mary University of London

Phimosis - A Simple Cure (That is working for me)

No nonsense, no adverts, no sales pitch, just honest information.

Glass Onion Blog

Cheat sheets, post-its and random notes from the desk of a programmer

Abode QA

A Hub For Testing Minds...

The Test Therapist

Performance & Security Testing Blog


a programmer's hub

Let's Not Crash and Burn

it makes your brain tingle


“Incinerate Ignorance”

Anastasia Writes

politics, engineering, parenting, relevant things over coffee.

One Software Tester

Trying To Make Sense Of The World, One Test At A Time

%d bloggers like this: