BrowserNativeMouseMove Function

Action

Sends a mouse-move event to the specified DOM element with a specified position.

The BrowserNativeMouseMove function uses the Windows API level events to simulate the mouse events instead of Java script events. Another difference to the BrowserMouseMove function is that you can specify a mouse position relative to the top left corner of the DOM element which is specified by the uTestObject parameter.

Include file

BrowserAPI.bdh

Syntax

BrowserNativeMouseMove( uTestObject : in union,
                        nX          : in number optional,
                        nY          : in number optional,
                        sTimer      : in string optional ): boolean;
Parameter Description
uTestObject The XPath locator or the handle to the DOM element.
nX Optional: X position relative to the top left corner of the DOM element. Defaults to the middle of the DOM element.
nY Optional: Y position relative to the top left corner of the DOM element. Defaults to the middle of the DOM element.
sTimer Optional: Name of the timer used for page measurements. If this parameter is omitted, no measurements are performed.

Return value

  • true if successful

  • false otherwise

Example

benchmark SilkPerformerRecorder

use "Kernel.bdh"
use "BrowserAPI.bdh"

dcluser
  user
    VUser
  transactions
    TInit           : begin;
    TMain           : 1;

var

dclrand

dcltrans
  transaction TInit
  begin
  end TInit;

  transaction TMain
  var
    liHandle : number;
  begin
    BrowserStart(BROWSER_MODE_DEFAULT, 800, 600);
    BrowserNavigate("http://demo.borland.com");
    liHandle := BrowserFind(HANDLE_DESKTOP, "//LI");
    
    // move the mouse to the first list item on the page
    BrowserMouseMove(liHandle);    
    // Alternatively you can use the native function
    // which also allows you to specify a relative margin
    BrowserNativeMouseMove(liHandle, 5, 5);
  end TMain;