Basic Concepts

Desktop Application Automation

Same Vocabulary, Different Target

GPAL.Application.Open launches (or attaches to) a desktop application by its executable path, returning the same kind of fluent workflow object that GPAL.Browser does. WithSelector, the action methods (LeftClick, FillInFrom, GetGrid, and the rest), CallIfFound/CallIfNotFound, and units of work all work exactly the same way. What changes is what GPAL is looking at: instead of a DOM, it's the Windows UI Automation tree of controls inside the application's windows.

var app = GPAL.Application

.Open("notepad.exe")

.ToGPALObject();


app

.WithSelector(GPAL.Selector.WithAutomationID("15"))

.FillInFrom("Hello from GPAL")

.WithSelector(GPAL.Selector.WithName("File"))

.LeftClick();

Finding Controls Without CSS

Browser selectors lean on CSS and XPath because that's how HTML documents are structured. Desktop applications have no DOM, so GPAL.Selector offers WithName and WithAutomationID for application controls. WithName matches a control's accessible name (the text a screen reader would announce), and WithAutomationID matches the AutomationId property that many Windows controls expose, which tends to be more stable across UI tweaks than visible text. WithClassName matches the underlying control's class, useful when several controls share a name but differ by type.

NOTE

OttoMatic Desktop exposes all of this information directly. It browses the running application's UI Automation tree, generates selectors and GPAL code, and you can open the result in Visual Studio and run it immediately.

When to Use Application vs Browser

If the thing you are automating is a website, GPAL.Browser is almost always right. Reach for GPAL.Application when there is no DOM at all: native Windows applications, legacy Win32 programs, or any GUI that exposes its controls only through UI Automation.

NOTE

WithHardware simulates OS-level mouse and keyboard input. Works for GPAL.Application selectors the same way it does for GPAL.Browser. See 'Hardware-Level Interaction' for when and why to use it.

WARNING

GPAL.Application ships in two variants: one built on .NET UIAutomation and one on COM UIAutomation. These target different Windows application stacks and have different compatibility profiles. The NuGet package you install determines which variant is active.

💬 Ask GPAL