Applies to TestComplete 14.70, last modified on October 26, 2020

Description

Use the HoverMouse action to place the mouse pointer at the specified position within an object. You can use this action to simulate a hovering (hot-tracking) event over an onscreen object or window.

Declaration

TestObj.HoverMouse(ClientXClientY)

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   
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 mouse pointer will be placed. This coordinate is relative to the object, it is not a screen coordinate. If ClientX is -1 (the default value), the mouse pointer will be moved to the object center.

ClientY

Specifies the vertical coordinate of the point where the mouse pointer will be placed. This coordinate is relative to the object, it is not a screen coordinate. If ClientY is -1 (the default value), the mouse pointer will be moved to the object center.

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 HoverMouse action in scripts:

JavaScript, JScript

var p, w;
p = Sys.Process("notepad");
w = p.Window("Notepad", "*", 0).Window("Edit", "", 0);
w.HoverMouse(30, 40);

Python

p = Sys.Process("notepad")
w = p.Window("Notepad", "*", 0).Window("Edit", "", 0)
w.HoverMouse(30, 40)

VBScript

Set p = Sys.Process("notepad")
Set w = p.Window("Notepad", "*", 0).Window("Edit", "", 0)
Set w = w.Window("Edit", "", 0)
w.HoverMouse 30, 40

DelphiScript

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

C++Script, C#Script

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

See Also

Simulating Mouse Wheel Rotation

Highlight search results