Application

Mouse, Keyboard, and Input

Methods for clicking elements, typing text, pressing special keys, and switching focus between controls in a desktop application.

Methods for clicking elements, typing text, pressing special keys, and switching focus between controls in a desktop application.

LeftClick, LeftDoubleClick, and RightClick operate on the element matched by the current selector. Hover moves the mouse over the element. MoveTo moves the cursor to the element position. Focus sets keyboard focus to the matched element. SendString types a literal string. SendKey sends virtual key codes for Enter, Tab, arrow keys, and other special keys. PressModifierKey and ReleaseModifierKey hold modifier keys across subsequent actions. SwitchToTab switches focus to a TabControl element matched by the current selector.

Examples

GPAL Fluent: High-level fluent C# API

//SendKey accepts Windows virtual key codes as a byte. Common values: 0x0D = Enter, 0x09 = Tab, 0x1B = Escape, 0x26/0x28 = Up/Down Arrow. Use SendString for printable characters.

// Click a button and type in a text field GPAL.Application .Open("C:\MyApp\app.exe") .WithSelector(GPAL.Selector.WithAutomationID("txtSearch")) .LeftClick() .SendString("search term") .SendKey(0x0D) // Enter .WithSelector(GPAL.Selector.WithAutomationID("btnExport")) .LeftClick(); // Use modifier keys GPAL.Application .Open("C:\MyApp\app.exe") .WithSelector(GPAL.Selector.WithAutomationID("txtNotes")) .PressModifierKey(ModifierKeys.Control) .SendKey(0x41) // Ctrl+A .ReleaseModifierKey(ModifierKeys.Control) .SendString("replacement");