Skip to main content

Drag Web Element

Command description

Drag from the specified web element. The virtual mouse does not take control of the physical pointer, and the command activates the element's webpage.

If the element is outside the viewport, the command scrolls it into view before dragging.

Drag distances use physical pixels. JavaScript element.getBoundingClientRect() returns CSS pixels; multiply them by devicePixelRatio to obtain physical pixels.

The width, height, position, and slider CAPTCHA distance obtained from web elements are all measured in physical pixels.

Command Input Parameters

input parametersInput parameter typeDescription
Webpage ObjectWebPageWebpage containing the target element
Web ElementWebElement or str (captured element UID, not element name, not ms-rpa-id)Select a captured element or one returned by Get Web Element, Get Similar Web Elements, or Get Related Web Elements
Drag MethodenumMouse Drag, CDP Silent Drag
Horizontal Drag DistancenumberHorizontal distance in physical pixels; positive moves right and negative moves left
Vertical Drag DistancenumberVertical distance in physical pixels; positive moves down and negative moves up
Mouse Pointer PositionenumRandom, Center; starting position within the element
Element Wait DurationnumberMaximum time to wait for the element to appear, in seconds

Command Output Parameters

None

Type definition reference

Drag method

Drag methodDescription
Mouse DragBrings the browser to the foreground and performs a physical mouse drag
CDP Silent DragDrags through Chrome CDP without using the physical mouse or bringing the browser forward. It can run when the browser is off-screen or covered by another window
tip
  • Install the Runavelo browser extension before using this command.
  • CDP Silent Drag requires Runavelo 7.7.0 or later and browser extension 2.4.0 or later.

Example

Drag a verification slider.

FAQ

See Web Automation FAQ