DblClick Action

Applies to TestComplete 14.72, last modified on April 22, 2021

Description

Use the DblClick action to simulate a double-click of the left mouse button over the object.

Declaration

TestObj.DblClick(ClientXClientYShift)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
ClientX [in]    Optional    Integer Default value: -1   
ClientY [in]    Optional    Integer Default value: -1   
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 point where the double-click should be simulated. This coordinate is relative to the object, it is not a screen coordinate. If ClientX is omitted, the double-click will be simulated in the center of the object.

ClientY

Specifies the vertical coordinate of the point where the double-click should be simulated. This coordinate is relative to the object, it is not a screen coordinate. If ClientX and ClientY parameters are omitted, the double-click will be simulated in the center of the object.

Shift

Sets whether the Shift, Alt or Ctrl keys are pressed during the double-click 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

  • 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 and ClientY 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 and ClientY parameter values relative to the web page, regardless of the browser zoom and the system's DPI setting.

Example

The following example demonstrates how to use the DblClick action in scripts:

JavaScript, JScript

var p, w;
p = Sys.Process("notepad");
w = p.Window("Notepad", "Untitled - Notepad", 0);
w = w.Window("Edit", "", 0);
w.DblClick(30, 40);

Python

p = Sys.Process("notepad")
w = p.Window("Notepad", "Untitled - Notepad", 0)
w = w.Window("Edit", "", 0)
w.DblClick(30, 40)

VBScript

Set p = Sys.Process("notepad")
Set w = p.Window("Notepad", "Untitled - Notepad", 0)
Set w = w.Window("Edit", "", 0)
w.DblClick 30, 40

DelphiScript

var
  p, w : OleVariant;
begin
  p := Sys.Process('notepad');
  w := p.Window('Notepad', 'Untitled - Notepad', 0);
  w := w.Window('Edit', '', 0);
  w.DblClick(30, 40);
end;

C++Script, C#Script

var p, w;
p = Sys["Process"]("notepad");
w = p["Window"]("Notepad", "Untitled - Notepad", 0);
w = w["Window"]("Edit", "", 0);
w["DblClick"](30, 40);

See Also

Simulating User Actions
DblClickM Action
DblClickR Action
Click Action
Drag Action
MouseDown Method (Desktop Objects)
MouseUp Method (Desktop Objects)

Highlight search results