Click UI Element

The Click UI Element block is used in Desktop UI automation to click a UI element, such as a button, checkbox, or other interactive control, in an already open application window. When executed, the target element is located, scrolled into view if needed, and clicked according to the configured method and button settings.

Fully expanded, the Click UI Element block shows the following properties:

image-20260108-093846.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 Click UI Element onto the canvas.

  2. Capture the target in Select UI Element (required) and optionally adjust parameters such as Method, Button, Hold Duration, Default timeout, Timeout.

  3. Run the flow when it’s ready.

For a minimal setup, set Select UI Element to the control you want to click, keep the default click settings, and run the flow.

Building block parameters

Parameters
  • Block header: Shows the current name of the Click UI Element block. You can rename it at any time by double-clicking the header and typing a new title to keep flows readable and organized.

  • Select UI Element: Contains the locator for the UI element to be clicked. This parameter must be set for the block to operate.

    • Click the field and choose Capture new element to capture a locator.

    • Choose Edit element to adjust an existing locator.

    • Right-click and select Clear element to remove it.

  • Method: Determines how the element is activated:

    • Click – positions the mouse pointer on the element and performs a mouse click using the button defined in Button.

    • Invoke (when available) – uses the Windows “Invoke” automation pattern to trigger the element without moving the mouse pointer, which can be faster for some applications.

  • Button: Selects which mouse button and click type to use. By default, the Left mouse button is used. Options include:

    • Left: single click with the left mouse button.

    • Right: single click with the right mouse button.

    • Middle: single click with the middle mouse button.

    • Double Left: double click with the left mouse button.

    • Double Right: double click with the right mouse button.

    • Double Middle: double click with the middle mouse button.

  • Hold Duration (sec): Specifies how long the left mouse button should be held down on the selected UI element before being released, in seconds.

    • The default value is 0 seconds.

    • You can configure any value from 0 to 10 seconds.

    • This parameter is only available when Button = Left.

  • Speed: Indicates the speed setting used when performing the click (for example, Medium), as exposed by the block in Studio.

  • Found element: Contains the UI element that was found in the desktop application window. You can use this as a source in other blocks to narrow searches to a specific region or control. If the element is not found, this property is empty.

    A Found element from one block can also be connected to Select UI Element in another block to reuse the same element instead of searching again.

  • Not found: Triggers if the UI element cannot be found within the time specified in Timeout. If no blocks are attached to this connector and the element is not found, the case ends with status Fail. You can use this output to branch the flow depending on whether the element is found.

  • Position found: Returns the position of the UI element on the application canvas as X, Y coordinates, relative to the top-left corner of the screen (usually 0, 0).

    • In multi-screen setups, coordinates can be negative or larger than a single screen’s resolution depending on monitor arrangement.

    • Elements that are not visible are reported at position 0, 0.
      You can expand this parameter to work with X and Y separately.

  • Area found: Returns the position and size of the found element as X, Y, Width, Height coordinates, relative to the top-left corner of the screen. In multi-screen environments, the coordinates can be negative or exceed a single screen’s resolution for the same reasons noted under Position found. You can expand this parameter to access and use each value individually.

  • Source element: Limits the search to run inside a previously captured source element instead of searching the entire application window. For example, you can capture a table row in one block and then use Source element to find and click a specific cell or field within that row.

  • Use occurrence: Determines which occurrence of the matching UI element to click when more than one is found:

    • Specific index: click one particular occurrence (for example, the first or second match).

    • All: iterate through all occurrences. When All is selected, the sub-properties Current index and the Completed output become available, and the main execution path triggers once per occurrence.

  • Current index: Indicates the index of the current occurrence when iterating through all matches. For example, if three matching elements are found, this property will be 1 for the first click, 2 for the second, and 3 for the last.

  • Completed: Triggers when iteration through all occurrences has finished while Use occurrence = All.

  • Count: Contains the total number of UI elements found that match the locator defined in Select UI Element. This can be used for validations or for decisions later in the flow.

  • Default timeout: Controls how the timeout for this block is determined:

    • When the checkbox is not selected, the block uses a timeout of 10 seconds, unless you override it via Timeout.

    • When the checkbox is selected, the block uses the Default timeout value defined in the flow settings.

  • Timeout: Sets the maximum time the block spends searching for the UI element before giving up and triggering the Not found output. This timeout applies only to this block. Each case also has a separate global timeout configured in the Settings panel; if the case runs longer than that global timeout, it is cancelled regardless of this block’s timeout.

  • Scroll to find: Specifies whether scrolling should be used when searching for the UI element. When you select a value other than None, the block scrolls through scrollable content while searching, which is useful for lists or views that load elements dynamically (such as infinite scroll).

  • Await no changes: When selected, instructs the block to wait until there have been no visible changes on screen for the period specified in Await Timeout before performing the click operation. This can help ensure that the UI has settled before interacting with it.

  • Await Timeout: Defines, in seconds, how long the screen must remain unchanged when Await no changes is enabled before the block proceeds with the click.

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.

Strategy Editor

Guidelines for understanding and using the Strategy Editor in Leapwork to define, refine, and validate robust locator strategies for UI elements using DOM structure, tokens, and wildcards.