Window- and Screen-Relative Low-Level Procedures

Applies to TestComplete 15.47, last modified on January 20, 2023
Information in this topic applies to desktop and web applications.

A low-level procedure can be recorded either in window-relative or screen-relative coordinates.

The key differences between window-relative and screen-relative coordinates are the following:

  • Window-relative procedures do not depend on the window position on screen, so they are useful if the position of the tested window changes from one test run to another (or within the same test run) and if you cannot position the window before executing the procedure. One more benefit is that a window-relative procedure can be re-used for any other window (see below).

    Note however that window-relative procedures only work for one window, you cannot use them to simulate user actions over several windows.

  • Screen-relative procedures are recorded by absolute screen coordinates. These procedures are useful when you need to simulate low-level events over several windows.

The internal structure of a window-relative procedure is the same as the structure of a screen-relative procedure. The difference is only in the coordinates of mouse and keyboard events that TestComplete registers during the recording.

The execution of a low-level procedure does not depend on the procedure’s type. A window-relative procedure can be executed for any window existing in the system, or it can be executed for the whole screen. The same concerns screen-relative procedures: they can be executed over the entire screen or over individual windows.

The object that the procedure will be executed over is specified by the parameter of the Execute method. If this parameter specifies a window, the procedure will simulate the recorded events for this window. If the parameter is omitted, the procedure will play back events for the screen.

JavaScript, JScript

LLCollection1.LLP1.Execute(); // Screen-relative execution
// or
LLCollection1.LLP1.Execute(w1); // Window-relative execution

Python

def Test():
  LLCollection1.LLP1.Execute() # Screen-relative execution
  # or
  LLCollection1.LLP1.Execute(w1) # Window-relative execution

VBScript

Call LLCollection1.LLP1.Execute ' Screen-relative execution
' or
Call LLCollection1.LLP1.Execute(w1) ' Window-relative execution

DelphiScript

LLCollection1.LLP1.Execute(); // Screen-relative execution
// or
LLCollection1.LLP1.Execute(w1); // Window-relative execution

C++Script, C#Script

LLCollection1["LLP1"]["Execute"](); // Screen-relative execution
// or
LLCollection1["LLP1"]["Execute"](w1); // Window-relative execution

If you start a low-level procedure from the context menu of the Project Explorer panel or run a procedure as a test item, the procedure will be executed relative to the screen.

Note that TestComplete does not re-calculate recorded coordinates during the playback, so, running a screen-relative procedure for a window most likely will be meaningless because recorded mouse clicks and keyboard events will be simulated at wrong points. Running a window-relative procedure for the screen may be successful, if the window is maximized.

See Also

Testing Applications in Low-Level Mode
Creating and Recording Low-Level Procedures
Running Low-Level Procedures

Highlight search results