ZenoTest
ZenoTest — Windows desktop UI test automation for Qt, WPF, WinForms & native apps. Record, script, and run automated GUI tests with CI/CD integration.

SendKeys

void SendKeys(String keys)
void SendKeys(String control, String keys)

Description
Sends the specified key sequence to a target control or application window. If a control is specified, the function will first set focus to the target element by clicking on or inside it.
The function can simulate typing text, keyboard shortcuts, or special keys.
Modifier keys (CTRL, SHIFT, ALT) and special keys must be enclosed in curly braces `{}`. Multiple modifiers can be combined inside a single set of braces using `+`, e.g., `{CTRL+SHIFT+ESC}`.
You can also send multiple special keys in sequence, e.g., `{CTRL+A}{DELETE}`.

Parameters
- control (optional) - The identifier or name of the control to receive the key input. If omitted, keys are sent to the currently focused window.
- keys - The string representing the keys to send. Can include:
  - Plain characters (letters, digits, symbols)
  - Special keys enclosed in {}:
  • {ENTER}
  • {RETURN}
  • {NUMPADENTER}
  • {TAB}
  • {BACKSPACE}
  • {ESC}
  • {SPACE}
  • {LEFT}
  • {RIGHT}
  • {UP}
  • {DOWN}
  • {DELETE}
  • {HOME}
  • {END}
  • {PAGEUP} (alias {PGUP})
  • {PAGEDOWN} (alias {PGDN})
  • {CTRL}
  • {SHIFT}
  • {ALT}
  - Modifier key combinations inside {}:
  • {CTRL+C} - Copy
  • {CTRL+V} - Paste
  • {CTRL+A} - Select all
  • {CTRL+SHIFT+ESC} - Open Task Manager
  • {ALT+TAB} - Switch windows
  - Multiple special keys in sequence:
  • {CTRL+A}{DELETE} - Select all and delete
  • {HOME}{SHIFT+END}{DELETE} - Select entire line and delete
Examples
void main()
{
    SendKeys("P@ssw0rd");                   // Types the text into the currently focused input
    SendKeys("TXT_PASSWORD", "P@ssw0rd");   // Types the password into the password textbox
    SendKeys("{ENTER}");                    // Presses the Enter key in the currently focused window
    SendKeys("BTN_OK", "{ENTER}");          // Presses Enter in the specified control
    SendKeys("TEXT_INPUT", "1+1=");         // Types 1+1= literally, no modifiers
    SendKeys("APP_WINDOW", "{CTRL+SHIFT+ESC}"); // Opens Task Manager with Ctrl+Shift+Esc
    SendKeys("{CTRL+A}{DELETE}");           // Select all and delete in the currently focused window
}
#define #include CloseAUT Console mode do...while DoubleClick Execute Fail File for GetAUTFileVersion GetAUTProductVersion GetAUTQtVersion GetAUTSuspectedCompiler GetAUTSuspectedFramework GetCurrentWorkingDir GetName GetProcessID GetProcessIDHandle GetQtProperty GetText GetValue Handle HasFocus IsAUT64Bit IsChecked IsEnabled IsVisible LeftMouseClick LeftMouseDown LeftMouseUp MiddleMouseDown MiddleMouseUp MouseWheel Pass Predefined Constants Print rand RightMouseClick RightMouseDown RightMouseUp Script Language SendKeys SendMessage SetFocus SetNotFoundBehavior SetQtProperty ShellProcess Sleep StartAUT string TerminateProcess TimerStart TimerStop TimerVerifyLess vec2d VerifyContains VerifyEndsWith VerifyEqual VerifyExists VerifyGreater VerifyLess VerifyNotEqual VerifyNotExists VerifyScreenCompareEdgeBased VerifyScreenComparePixelExact VerifyStartsWith while