Automating interactions with Windows applications and dialog boxes

Prev Next

Windows dialogs such as “Save As” are inherently difficult to automate. These dialogs are operating system–level components, meaning they exist outside the application being tested and are not directly controlled by it. As a result, most automation tools have limited or no ability to reliably interact with them.

In addition, these dialogs can vary between environments (e.g., different Windows versions, system settings, or browser configurations), which can lead to inconsistent behavior and unstable test results.

Best Practices

To ensure more reliable automation, it is recommended to avoid interacting with OS-level dialogs altogether. Instead:

  • Configure automatic downloads to bypass the “Save As” prompt

  • Validate downloaded files through the file system (e.g., checking file existence or contents)

  • Use APIs or backend validation where available to confirm file generation

Windows automation in ScriptBuilder

Sending keystrokes

ScriptBuilder provides the ability to send keystrokes to Windows applications, enabling interaction with elements that may not be directly accessible through standard automation methods.

This functionality extends the same keystroke automation capabilities already available for web and SAP GUI environments to Windows-based applications.

Using keystroke automation, you can:

  • Navigate between input fields using keyboard controls

  • Handle login dialogs more effectively

  • Trigger internal functions via keyboard shortcuts

  • Perform search actions within applications

Windows application commands

ScriptBuilder also includes dedicated Windows Application Commands to support scenarios where a test needs to briefly interact with a Windows-based application.

The following instructions support direct interaction with Windows application elements:

  1. Click element on Windows application

  2. Enter text in Windows application

Use these commands for lightweight interaction with Windows desktop elements, such as occasional input or clicks during a primarily web- or SAP-based test. See ScriptBuilder Instruction Types: Windows Automation for instruction details.

Example: Save an SVG file with Notepad

This example generates a QR code, copies its SVG code, pastes the code into Notepad, and saves the file using the Save As dialog.

Run the workflow

  1. Generate a QR code.

  2. Click Copy SVG Code.

  3. Run Notepad.

  4. Send Ctrl+V to paste the copied SVG code.

  5. Send Ctrl+S to open the Save As dialog.

  6. Use Set file for save as to specify the save location.

Launch Notepad

Run Notepad using notepad.exe. On Windows, you do not need to specify the full executable path.

Note

Enter a filename into the ‘Arguments’ field and Notepad will open that particular file (needs to include the full path to an existing file, including the path, filename and file extension).

Handle changing window titles

When automating interactions with Notepad, it is important to account for how the application’s window title changes during use.

  • By default, a new Notepad window is titled “Untitled - Notepad”

  • After content is added (such as pasting SVG data), the title updates to reflect the file name or content state

Because of this dynamic behavior, using the full window title in automation can cause the step to fail once the title changes.

  • “- Notepad”

This allows the automation to reliably match the window regardless of how the leading portion of the title changes.

Where the window title varies, Windows automation instructions also support wildcard matching in the Window title field. Use a recognizable, stable part of the title to help identify the correct window even when the rest of its title changes.

In both Send keys steps, the Window title is ‘- Notepad’:

Save the file

To save the file, use the Set file for save as instruction:

Alternatively, to work with an existing file, pass its path and filename in the Arguments field of the Run program instruction when launching Notepad.