Window package guide
Capture, attach, activate, resize and close Windows application windows, and test their presence or title.
Version 2.15.0. Installed versions can differ. Examples are illustrative and not tested.
Prerequisites
Use a Windows Device, a compatible Mercury (the Device runner) and a signed-in desktop session. Actions work on visible top-level windows. A plain title matches with Contains and ignores case; if many windows match, the newest process wins. A captured Window keeps finding the same window even if its title changes. When a window is not found, an action fails after the normal 5-second search.
Create a test file C:\AutomationSamples\invoice.txt, open it in Notepad and capture its real Window with the editor picker. Use Attach or open with open=Never, bind its output window to Window $sampleWindow$, and pass the whole value to later steps. Launch needs a captured application path; do not write the Window JSON by hand.
A browser Window can hold Chrome or Edge and a page URL. Activate, Assign, Close, Maximize, Minimize, Resize, Restore and Set title first select a named tab through Janus (the Palatine browser extension). Tab selection needs Mercury 3.0.0 or later and a connected Janus. Attach and the conditions check only the native window (title, process, class, handle), not the tab or its URL. A captured Window's own title rule wins over Window title is. Use a separate test desktop for Close all, and close all sample windows afterwards.
Number inputs are whole numbers in the stated units (seconds, milliseconds, counts or pixels).
Shared fields
Activate, Close, Maximize, Minimize, Resize, Restore and the four conditions use window and windowMatch; the conditions also use waitTimeout.
| Input | Editor field | Type; default; editor rule | Value |
|---|---|---|---|
window | Window | Windowdefault emptyoptional. | A captured Window or $sample from Attach or open. A plain title such as Automation Sample also works. Name the test window: empty text can match another window. |
window | Window title is | Windowdefault Containsoptional. | Contains: part of the title; Exact: the whole title; Wildcard: * any text, ? one character; Regex: regular expression; Active: the window in front, whatever its title. Case is ignored unless a captured Window has its own rule. |
wait | Wait for this condition (seconds) (Window exists, Window does not exist) or Keep trying for (seconds) (same-title conditions) | Numberdefault 0optional. | Seconds to keep looking (every 250 ms). 0 or less checks once. Conditions do not look for browser tabs. |
Actions
Activate (windowActivateWindow)
Bring the window to the front. A browser Window that names a page URL or tab title first selects that tab through Janus.
Inputs
Uses the shared fields: window, windowMatch.
Outputs
No output fields.
Example
Put another test window in front of the sample. Set window=$sampleWindow$, windowMatch=Contains.
Expected result
The sample window comes to the front. A named browser tab that is missing fails.
Get active window title (windowActiveWindowTitle)
Read the title of the window in front. Use it to check focus before a keyboard step.
Inputs
No inputs.
Outputs
| Output | Type | Value |
|---|---|---|
title | String | The title of the window in front. This is text, not a captured Window value. |
Example
Activate the Notepad sample (title contains invoice.txt). Bind title to String $activeTitle$.
Expected result
$activeTitle$ holds the exact current title, with any application suffix. It is empty when no window is in front.
Assign (windowAssign)
Find a source window and capture it as a Window value (title, application and handle). Later steps then act on that same window.
Inputs
| Input | Editor field | Type; default; editor rule | Value |
|---|---|---|---|
source | Select the source window variable/ value | Windowdefault emptyoptional. | A captured source Window, $sample or a plain title. The matching window is captured into a new Window value. |
source | Window title is | Windowdefault Containsoptional. | The same choices as window in shared fields. |
Outputs
| Output | Type | Value |
|---|---|---|
result | Window | Window value captured from the real matching window. |
Example
Open the Notepad sample. Set sourceWindow=invoice.txt, sourceWindowMatch=Contains. Bind result to Window $assignedWindow$.
Expected result
$assignedWindow$ holds a captured Window with a handle (not zero). Later Window actions can use it even if the title changes. This action does not create a window.
Attach or open (windowAttach)
Find the captured Window and, if you want, start its application. The output keeps the found window's handle. The browser tab is selected later by a Clio step or Activate.
Inputs
| Input | Editor field | Type; default; editor rule | Value |
|---|---|---|---|
window | Window | Windowdefault empty Windowoptional. | The captured Window to find or launch. |
open | Open the application | Opendefault Ifoptional. | Never: attach only. If: launch if no match. Always: launch even with a match, but the window found before launch can be returned. A new instance is not guaranteed. |
timeout | Timeout (s) | Numberdefault 30optional. | Seconds to find a matching window after any launch. 0 or less: one search only. The search ignores browser tab URLs. |
Outputs
| Output | Type | Value |
|---|---|---|
window | Window | The input Window with the found handle filled in. Pass the whole variable to later Window or Clio inputs. |
Example
Open invoice.txt in Notepad. In the Window picker, capture this real window with its application path. Set window to that captured value, open=Never, timeoutSec=10. Bind output window to Window $sampleWindow$. To allow launch after closing it, keep the captured application path and choose IfNotOpen.
Expected result
$sampleWindow$ has the window handle. With Never and no match, the step fails with NO_WINDOW after 10 seconds. A desktop application launch needs its path. A browser launch opens Chrome or Edge at the captured URL, but the search cannot check which tab is active.
Close all (windowCloseAllWindows)
Ask every visible top-level window to close, except windows whose title matches the list and windows of the running process. This can close other applications: use a separate test desktop.
Inputs
| Input | Editor field | Type; default; editor rule | Value |
|---|---|---|---|
open | Windows to keep open | Listdefault empty Listoptional. | List of Strings, such as $keep, matched with Contains, ignoring case. Empty: closes every visible top-level window except those of the running process. |
Outputs
No output fields.
Example
On a test desktop, open only two sample windows: invoice.txt and scratch.txt. Populate List of Strings $keepTitles$ with invoice.txt. Set openWindowList=$keepTitles$.
Expected result
invoice.txt stays; scratch.txt is asked to close. An application with unsaved work can ask to save and stay open.
Close (windowCloseWindow)
Ask the selected window to close, like its X button.
Inputs
Uses the shared fields: window, windowMatch.
Outputs
No output fields.
Example
Use a sample with no unsaved edits. Set window=$sampleWindow$, windowMatch=Contains.
Expected result
The window is asked to close and normally disappears, but a save or confirmation dialog can keep it open. The process is not forced to end.
Maximize (windowMaximizeWindow)
Maximize the window.
Inputs
Uses the shared fields: window, windowMatch.
Outputs
No output fields.
Example
Use a sample window that can be resized. Set window=$sampleWindow$, windowMatch=Contains.
Expected result
The sample window grows to its maximized size if the application supports it. A window that cannot be maximized can ignore the request.
Minimize (windowMinimizeWindow)
Minimize the window. Use Restore before later steps that need a visible control.
Inputs
Uses the shared fields: window, windowMatch.
Outputs
No output fields.
Example
Use a visible sample window. Set window=$sampleWindow$, windowMatch=Contains.
Expected result
The sample window is minimized if the application supports it. Later mouse or screenshot steps can fail until it is restored.
Resize (windowResizeWindow)
Move and resize the outer window, in screen pixels. A minimized or maximized window is restored first.
Inputs
Uses the shared fields: window, windowMatch.
| Input | Editor field | Type; default; editor rule | Value |
|---|---|---|---|
left | Left | Numberdefault 0optional. | Left edge, in pixels from the left of the screen, such as 100. |
top | Top | Numberdefault 0optional. | Top edge, in pixels from the top of the screen, such as 100. |
width | Width | Numberdefault 0optional. | Outer width in pixels, more than 0, such as 900. The application's size limits can change the result. |
height | Height | Numberdefault 0optional. | Outer height in pixels, more than 0, such as 600. |
Outputs
No output fields.
Example
Set window=$sampleWindow$, windowMatch=Contains, left=100, top=100, width=900, height=600 on a screen that can show that rectangle.
Expected result
The sample window moves to (100,100) with outer size 900 × 600. The application can keep a minimum size. If Windows refuses the move, the step fails.
Restore (windowRestoreWindow)
Restore a minimized or maximized window to its normal state.
Inputs
Uses the shared fields: window, windowMatch.
Outputs
No output fields.
Example
Minimize the sample window first. Set window=$sampleWindow$, windowMatch=Contains.
Expected result
The sample window returns to its normal size. Restore does not set a size or position and does not bring the window to the front.
Set title (windowSetTitle)
Change a window's visible title. Use it only on a test window: later steps that find the window by title can stop matching it.
Inputs
| Input | Editor field | Type; default; editor rule | Value |
|---|---|---|---|
source | Window | Windowdefault emptyoptional. | A captured source Window, $sample or a plain title: the window to rename. |
filter | Window title is | Filterdefault Stringoptional. | String: Contains for a plain title. Regex: regular expression. A captured Window keeps its own rule. |
new | New window title | Stringdefault emptyoptional. | New title, such as Automation Sample; empty sets an empty title. The application can change it again later. |
Outputs
No output fields.
Example
For the Notepad sample, set sourceWindow=$sampleWindow$, filterType=StringValue, newTitle=Automation Sample. Keep the pinned Window variable for later steps.
Expected result
The title becomes Automation Sample. The application can still reset its own title later. If Windows refuses the change, the step fails.
Conditions
Window exists (windowExists)
True when a window matches. A captured Window still matches its window after a title change.
Inputs
Uses the shared fields: window, windowMatch, waitTimeout.
Outputs
No output fields. Gives true if the condition is met during the wait, otherwise false. An error fails the condition.
Example
Use the Notepad sample. Set window=$sampleWindow$, windowMatch=Contains, waitTimeout=2. Check while it is open, then close it and check again.
Expected result
While the selected window is open: true. After it closes with no other selector match: false when the wait ends.
Window does not exist (windowNotExists)
True when no window matches. A captured Window counts as present while its window is open, even after a title change.
Inputs
Uses the shared fields: window, windowMatch, waitTimeout.
Outputs
No output fields. Gives true if the condition is met during the wait, otherwise false. An error fails the condition.
Example
Use the Notepad sample. Set window=$sampleWindow$, windowMatch=Contains, waitTimeout=2. Check while it is open, then close it and check again.
Expected result
While the selected window is open: false. After it closes with no other selector match: true. If it stays open for the whole wait: false.
Window with same title does not exist (windowTitleDoesNotExists)
True when the captured window is gone or its title no longer fits the captured title rule. Without a handle, it is true when no window matches.
Inputs
Uses the shared fields: window, windowMatch, waitTimeout.
Outputs
No output fields. Gives true if the condition is met during the wait, otherwise false. An error fails the condition.
Example
Prepare $sampleWindow$ by Attach or open while its title contains invoice.txt. Set window=$sampleWindow$, windowMatch=Contains, waitTimeout=0. Then repeat after Set title changes it to Automation Sample.
Expected result
Before the change: false; after a title that no longer matches: true. Closing the window also gives true. A captured rule without a title only checks that the window is still there.
Window with same title exists (windowTitleExists)
True when the captured window is still open and its title fits the captured title rule. Without a handle, any matching window counts.
Inputs
Uses the shared fields: window, windowMatch, waitTimeout.
Outputs
No output fields. Gives true if the condition is met during the wait, otherwise false. An error fails the condition.
Example
Prepare $sampleWindow$ by Attach or open while its title contains invoice.txt. Set window=$sampleWindow$, windowMatch=Contains, waitTimeout=0. Then repeat after Set title changes it to Automation Sample.
Expected result
Before the change: true; after a title that no longer matches: false. Because of the handle, another window with the old title does not count. With no title rule, the window only has to be there.