Drag Mouse


The Drag mouse block simulates a mouse drag action on the screen, moving from one point to another while holding down a mouse button. This action is useful for dragging items across the screen, selecting areas, or triggering UI behaviors that rely on click-and-drag gestures.

The block typically receives its Start position and End position from upstream blocks such as Find image, Get text, or Get number, which provide dynamic coordinates.

Fully expanded, the Drag mouse block shows the following properties:

image-20251118-090356.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 Drag mouse onto the canvas.

  2. Connect dynamic values or enter coordinates for Start position and End position.

  3. Adjust Button, Speed, or Await no movement if needed.

  4. Run the flow when it’s ready.


Building block parameters

Parameters
  • Block header: The green input connector triggers the block to start executing. The green output connector triggers when a screenshot has been successfully taken. You can rename the block title (“Drag mouse”) by double-clicking it and typing in a new title.

  • Start position
    Defines the screen coordinates where the drag begins. This position is specified in X and Y, relative to the top-left corner of the screen (0, 0). You can expand the field to edit both values or connect dynamic input.

  • End position
    Defines the screen coordinates where the drag ends. As with Start position, the values are relative to the screen’s top-left corner. You can edit X and Y separately or connect values from another block.

  • Button
    Specifies which mouse button is used for the drag. Default is Left, but other options may be available depending on context (e.g., right-click drag).

  • Speed
    Controls the speed of the mouse movement between the start and end points. Options include:

    • Slow: Gradual movement, useful for visual clarity.

    • Medium: Recommended default for smooth recording and playback.

    • Fast: Quicker than medium, less visible motion.

    • Instantaneous: Moves the cursor instantly without visible movement.

  • Await no movement
    Delays the drag action until no screen activity has been detected for a set period. This helps ensure stability in dynamic interfaces (e.g., page loading or animations). If enabled, the block will wait for screen stability or up to a maximum of 30 seconds.

  • Await timeout
    Specifies how many seconds the screen must remain unchanged before the drag begins. Only applies if Await no movement is enabled.

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.