Test a GUI app with headless scripted input

A developer used one agent to build an image editor and another to exercise it through headless mouse and keyboard scripts.

Done with Claude CodeClaudeยท Advancedยท Nov 2026

What they did
They set up a headless sway session and a small daemon that exposed virtual keyboard and mouse input over a unix socket. A bash layer handled commands like launching the app, grabbing screenshots, moving the pointer, clicking, and typing, all documented in claude.md. Opus built the editor, while a Sonnet subagent used the scripted controls to test each tool and panel the developer described.
How it went
The subagent found most of the bugs on its own, so testing was largely automated. The developer still did a quick manual review, because a headless sway setup does not match a normal KDE desktop exactly.
Tips
If you try this, script real input events instead of leaning on accessibility APIs, since that proved more dependable here. It can also help to use a smaller tester subagent so the builder agent does not carry a long context into the test run.

Try it yourself with Claude Code

Build a small [GUI app type] in [language/toolkit] in this folder. First, make a headless test setup with a display compositor plus scripted mouse and keyboard control, and document the commands for launching the app, taking screenshots, moving the pointer, clicking, and typing. Then have a separate subagent use those controls to open the app, exercise each panel and tool I describe, and report any broken behavior. After each round, fix the issues it finds and run the test again. Before any irreversible action such as deleting files, sending data, or submitting anything, stop and ask for my approval. At the end, list anything you could not fully confirm so I can review it manually.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.