Stopwatch

The Stopwatch building block measures elapsed time between different parts of an automation case. It can be used, for example, to measure how long an application takes to open or how long a business transaction takes to complete. In combination with a Compare block, it can also be used to assert that something completes within a specific time-frame.

Another example can be found in the Use the clipboard to insert text lesson, where the time it takes to insert text using different methods is measured using the Stopwatch block.

Fully expanded, the Stopwatch block shows the following properties:

image-20260207-095513.png

Note: The screenshot on this page uses the Elegance Design, introduced in 2025.3. If you are using an earlier version, your layout may look different.

Quick-start

  1. Drag Stopwatch onto the canvas.

  2. Connect the block in the flow. Trigger the block where you want to start (or reset) the timer, and use Elapsed time later in the flow.

  3. Run the flow when it’s ready.

Building block parameters

Parameters
  • Block header: The green input connector triggers the block to start executing and thereby starts or resets the stopwatch. The green output connector triggers once the stopwatch has been started (or reset). You can rename the block title (“Stopwatch”) by double-clicking it and typing a new title.

  • Elapsed time: Contains a timespan representing the total elapsed time since the stopwatch input was last triggered (for example 00:01:05:0004123). You can expand it to access the individual sub-properties Hour, Minute, Second, and Millisecond.

Flow Example

The following is an example of an endlessly looping test case that resets a stopwatch every 65 seconds, outputting the total elapsed time as well as the current elapsed seconds and milliseconds.

image-20260207-100149.png

In the example, for each iteration, Field 1 will contain a timespan value like 00:01:05:0004123, while Field 2 will contain 5 and Field 3 will contain something like 0,4123.

When used as a number (for example in a Calculate block), timespans are converted to the total number of seconds and milliseconds. In this example, that would be 65,0004123.

Resources

Topic

Description

Flows FAQ

Common questions about creating, running, and managing flows in Leapwork.

Flows Troubleshooting

Guidelines and solutions for identifying and fixing issues that occur when building or running flows in Leapwork.