[Collapse]TestComplete/viewarticle/63445/
 [Expand]General Information/viewarticle/63445/
 [Expand]Using Help System/viewarticle/55799/
 [Expand]Getting Started Tutorial/viewarticle/56246/
 [Expand]Using TestComplete/viewarticle/57875/
 [Expand]Testing Types/viewarticle/62721/
 [Expand]Applications Testing/viewarticle/62606/
 [Expand]Working With Application Objects and Controls/viewarticle/55815/
 [Expand]Samples and Tutorials/viewarticle/56239/
 [Collapse]References/viewarticle/57878/
  [Expand]Test Objects/viewarticle/57881/
  [Expand]Scripting Objects/viewarticle/57882/
  [Collapse]Project and Project Item Objects/viewarticle/57880/
   [Expand]Project Suite Objects/viewarticle/59766/
   [Collapse]Project Item Objects/viewarticle/59767/
     ActiveX Objects/viewarticle/56464/
    [Expand]Android Gesture Collection/viewarticle/59748/
    [Expand]Events/viewarticle/56945/
    [Expand]Image Repository/viewarticle/59749/
    [Expand]Keyword Testing/viewarticle/59771/
    [Collapse]Low-Level Procedures Collection/viewarticle/59772/
     [Collapse]LLPlayer/viewarticle/56754/
       LLPlayer Object/viewarticle/56754/
      [Collapse]LLPlayer Object Methods/viewarticle/58887/
        KeyDown Method/viewarticle/58896/
        KeyUp Method/viewarticle/58894/
        MouseDown Method/viewarticle/58892/
        MouseMove Method/viewarticle/56755/
        MouseUp Method/viewarticle/58888/
        MouseWheel Method/viewarticle/58889/
     [Expand]LowLevelProcedure/viewarticle/55226/
    [Expand]Manual Tests/viewarticle/59773/
    [Expand]Name Mapping/viewarticle/59774/
    [Expand]Network Suite/viewarticle/59775/
    [Expand]ODT/viewarticle/59776/
    [Expand]Script/viewarticle/59777/
    [Expand]Stores/viewarticle/59778/
    [Expand]Tested Applications/viewarticle/59779/
    [Expand]Unit Testing/viewarticle/59780/
    [Expand]User Forms/viewarticle/59781/
    [Expand]Web Services/viewarticle/59782/
   [Expand]Project Objects/viewarticle/59768/
   [Expand]Test Log Objects/viewarticle/59769/
   [Expand]COM Automation Objects/viewarticle/59770/
  [Expand]TestComplete Events/viewarticle/56945/
  [Expand]Language Reference/viewarticle/57879/
  [Expand]User Form Components/viewarticle/56689/
 [Expand]Other Tools That Help You Test Better/viewarticle/63442/
 [Expand]TestComplete 10 Licensing Guide/viewarticle/63451/
Updated: 7/16/2014 Applies To: TestComplete 10 Rating: No votes Click to rate: PoorNot badAverageGoodExcellent
Programming Reference

MouseDown Method

Description

Use the MouseDown method to simulate pressing of a mouse button. The method performs the same action as the MouseDown event of a low-level procedure.

Declaration

LLPlayer.MouseDown(ButtonXYDelay)

Button [in] Required Integer
X [in] Required Integer
Y [in] Required Integer
Delay [in] Required Integer
Result None  

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

Button

A constant specifying the mouse button, the pressing of which is to be simulated. You can use the following constants to specify the mouse button (these constants are provided by the Win32API plug-in).

Constant Integer Value Description
MK_LBUTTON 1 The left mouse button.
MK_RBUTTON 2 The right mouse button.
MK_MBUTTON 16 The middle mouse button.

X

Specifies the horizontal coordinate of the point for the click.

Y

Specifies the vertical coordinate of the point for the click.

Delay

The number of milliseconds passed after you command TestComplete to simulate the pressing of a mouse button and before TestComplete starts simulating the pressing. The delay gives you the possibility to better emulate real-life conditions. Also, it is necessary to separate the pressing from other low-level events in order to enable the operating system to properly process it.

If Delay is negative, it is set to the Auto-wait timeout.

If Delay is greater than 1000, the waiting progress will be shown in TestComplete’s indicator during the test run.

Result Value

None.

Example

The code below simulates pressing the left mouse button and then releasing it using the MouseDown and MouseUp methods.

VBScript

Sub LLPMouseButtonExample()

  ' Specifies the coordinates of the click
  coorX = 15
  coorY = 120
  
  ' Specifies a delay in milliseconds
  sDelay = 2000 ' 2 seconds
  
  ' Simulates pressing the left mouse button
  Call LLPlayer.MouseDown(MK_LBUTTON, coorX, coorY, sDelay)
  ' ...
  ' Simulates releasing the left mouse button
  Call LLPlayer.MouseUp(MK_LBUTTON, coorX, coorY, sDelay)
    
End Sub

JScript

function LLPMouseButtonExample()
{
  // Specifies the coordinates of the click
  var coorX = 15;
  var coorY = 120;
  
  // Specifies a delay in milliseconds
  var sDelay = 2000; // 2 seconds
  
  // Simulates pressing the left mouse button
  LLPlayer.MouseDown(MK_LBUTTON, coorX, coorY, sDelay);
  // ...
  // Simulates releasing the left mouse button
  LLPlayer.MouseUp(MK_LBUTTON, coorX, coorY, sDelay);
}

DelphiScript

function LLPMouseButtonExample;
var coorX, coorY, sDelay;
begin

  // Specifies the coordinates of the click
  coorX := 15;
  coorY := 120;
  
  // Specifies a delay in milliseconds
  sDelay := 2000; // 2 seconds
  
  // Simulates pressing the left mouse button
  LLPlayer.MouseDown(MK_LBUTTON, coorX, coorY, sDelay);
  // ...
  // Simulates releasing the left mouse button
  LLPlayer.MouseUp(MK_LBUTTON, coorX, coorY, sDelay);

end;

C++Script, C#Script

function LLPMouseButtonExample()
{
  // Specifies the coordinates of the click
  var coorX = 15;
  var coorY = 120;
  
  // Specifies a delay in milliseconds
  var sDelay = 2000; // 2 seconds
  
  // Simulates pressing the left mouse button
  LLPlayer["MouseDown"](MK_LBUTTON, coorX, coorY, sDelay);
  // ...
  // Simulates releasing the left mouse button
  LLPlayer["MouseUp"](MK_LBUTTON, coorX, coorY, sDelay);
}

See also
Testing Applications in Low-Level Mode | MouseUp Method | MouseMove Method | MouseWheel Method | Low-Level Procedure Events | MouseDown Method (Desktop Objects) | Simulating Mouse Actions


© 2014 SmartBear Software. All rights reserved.
Email Send feedback on this document