Leanpub Header

Skip to main content

Python Desktop Automation

Building Reliable Cross-Platform GUI Tests with pyguitest and pyguitest-recorder

Python Desktop Automation

Make desktop automation practical, reliable, and cross-platform. Discover how to automate real-world applications, record interactions, and build maintainable GUI tests with Python.

Minimum price

Free!

$10.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

Python Desktop Automation

Building Reliable Cross-Platform GUI Tests with pyguitest and pyguitest-recorder

Desktop automation shouldn't have to be fragile, platform-dependent, or limited to applications with built-in automation APIs.

Python Desktop Automation is a practical, hands-on guide to automating real desktop applications with Python. Learn how to interact with graphical interfaces, discover controls through accessibility, manage windows, simulate keyboard and mouse input, capture screenshots, synchronize application workflows, and build reliable automated GUI tests.

Using pyguitest and its companion recording tool, pyguitest-recorder, this book takes you from your first automation script to maintainable, cross-platform testing workflows.

Whether you're testing a traditional desktop application, automating a legacy system, validating a modern GUI, or building a cross-platform testing environment, you'll learn how to approach desktop automation systematically.

What You'll Learn
  • Build reliable GUI automation: Connect to desktop sessions, launch applications, locate controls, interact with interfaces, and verify results.
  • Use accessibility for smarter automation: Find buttons, text fields, menus, tables, and other controls by their meaning rather than relying exclusively on screen coordinates.
  • Master keyboard and mouse automation: Handle shortcuts, text entry, pointer movement, clicking, dragging, and other desktop interactions.
  • Understand modern Linux desktops: Explore X11, XWayland, native Wayland, AT-SPI accessibility, and permission-aware input.
  • Automate across operating systems: Understand the differences and capabilities of Linux, Windows, macOS, and BSD/Unix environments.
  • Record and generate automation scripts: Use pyguitest-recorder to capture real workflows and turn them into editable Python scripts.
  • Build maintainable automated tests: Integrate with pytest, manage test fixtures, diagnose failures, control flaky tests, and prepare repeatable CI environments.
  • Work with real-world interfaces: Explore GTK, Qt, Electron, Chromium, Tkinter, wxWidgets, and custom-rendered applications.
More Than an API Reference

This is a practical technical book designed to teach you how to think about desktop automation, not just memorize function calls.

Examples build progressively, starting with complete working scripts and explaining the purpose of individual operations. You'll learn why certain approaches are more reliable, how to recognize common automation failures, and how to adapt your scripts when different desktop environments expose different capabilities.

The book also includes a practical cookbook, guided exercises, troubleshooting advice, an extensive API reference, and additional examples covering functions not demonstrated in the main chapters.

Who Is This Book For?
  • Python developers interested in desktop automation.
  • Software engineers building automated GUI testing systems.
  • QA engineers and software testers.
  • Developers maintaining legacy desktop applications.
  • Linux developers exploring X11 and Wayland automation.
  • Anyone who needs to automate applications that don't provide a suitable programming API.
Open Source Projects

This book accompanies three open-source projects:

  • pyguitest: Python desktop automation and GUI testing.
  • pyguitest-recorder: Record desktop interactions and generate Python automation scripts.
  • python-libei: Python bindings for modern Wayland input integration.

Explore the projects and source code:

https://github.com/ctrondlp/pyguitest

https://github.com/ctrondlp/pyguitest-recorder

https://github.com/ctrondlp/python-libei

Make Desktop Automation Practical

Learn to move beyond fragile coordinate-based scripts and build automation that understands applications, verifies outcomes, and adapts to the realities of modern desktop environments.

Start building reliable desktop automation with Python.

Author

About the Author

Dennis K. Paulsen

Dennis K. Paulsen is a software engineer and open-source developer focused on desktop automation, cross-platform software, and modernizing complex systems.

He is the original author of X11::GUITest, a Perl-based framework for automating graphical applications on Unix and Linux systems. Building on that experience, he created pyguitest, pyguitest-recorder, and python-libei to bring practical, modern desktop automation to Python developers.

His work explores the challenges of automating real-world desktop applications across Linux, X11, Wayland, Windows, macOS, and BSD. He is particularly interested in accessibility-based automation, reliable testing, and making complex technical systems easier to use and maintain.

Through his open-source projects and technical writing, Dennis aims to help developers build more reliable software and make desktop automation accessible to a broader community.

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub