DragM Action

Applies to TestComplete 14.30, last modified on November 21, 2019

Description

Use the DragM action to simulate a dragging event that is performed with the middle mouse button over an onscreen object or window.

Declaration

TestObj.DragM(ClientXClientYtoXtoYShift)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ClientX [in]    Required    Integer    
ClientY [in]    Required    Integer    
toX [in]    Required    Integer    
toY [in]    Required    Integer    
Shift [in]    Optional    TShiftKey Default value: skNoShift   
Result None

Applies To

All onscreen objects.

View Mode

To view this method in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The method has the following parameters:

ClientX

Specifies the horizontal coordinate of the start point for DragMging. This coordinate is relative to the object, it is not a screen coordinate.

ClientY

Specifies the vertical coordinate of the start point for DragMging. This coordinate is relative to the object, it is not a screen coordinate.

toX

Specifies the horizontal DragMging distance in pixels.

toY

Specifies the vertical DragMging distance in pixels.

Shift

Sets whether the Shift, Alt or Ctrl keys are pressed during the DragMging event (see TShiftKey). By default, this parameter is skNoShift (no shift keys are pressed). Sometimes the Shift parameter may not be enough, and you may need to simulate key presses in script code. See Simulating Keystrokes.

Result Value

None.

Remarks

  • The DragM action works in the following manner:

    • Moves the mouse cursor to the point specified by the ClientX and ClientY parameters.
    • “Presses” the middle mouse button.
    • “Holds” the button down and moves the cursor to the distance specified by the toX and toY parameters.
    • “Releases” the mouse button.
  • Desktop testing: If TestObj refers to an object of a non-DPI-aware application running with a DPI setting other than 100%, set the ClientX, ClientY, toX and toY parameter values relative to the application (as if the application is running with the 100% DPI setting).

  • Web testing: If the Use CSS pixels for scaled pages option is enabled (by default), set the ClientX, ClientY, toX and toY parameter values relative to the web page, regardless of the browser zoom and the system's DPI setting.

  • In order to simulate dragging actions on Telerik RAD controls for Silverlight, increase the value of the Dragging delay project option (default value is 5 milliseconds, recommended value is 50 milliseconds or higher). Otherwise the dragging actions may not be simulated correctly.

See Also

Simulating User Actions
Drag Action
DragR Action
Click Action
DblClick Action
MouseDown Method (Desktop Objects)
MouseUp Method (Desktop Objects)

Highlight search results