Playing back low level mouse and keyboard actions

Low-level playback of mouse and keyboard actions provides more control of events of user actions. For example, Functional Tester currently supports, where the click consists of low-level actions including mouse move, left mouse button down, and left mouse button up. With this functionality, you can play back the individual components of a mouse click.

Low-level playback also supports mouse wheel scrolling.

You may want to use low-level playback to overcome a product limitation or an obscure mouse or keyboard action. For example, to draw a circle on a canvas in a drawing program, Functional Tester does not support the complex circular drag but you can use the drag() method to draw straight lines. To overcome an obscure mouse or keyboard action, you can use low-level playback to play back the mouse actions for drawing the circle.

The RootTestObject class includes two methods:

Factory methods on SubitemFactory for construction of LowLevelEvents include:

Parallel methods exist for the middle and right mouse buttons. The delay event guarantees a delay of at least the milliseconds specified, taking into account the time taken by the system to consume the previous event.

A Functional Tester, Java Scripting example to draw the letter V in the upper left portion of the drawing canvas:

// This routine will draw a "V" in the upper left portion
// of the drawing canvas.
// First a point in the upper left corner will be clicked, the left mouse
// button will be held down for the duration of the action, the mouse
// will be moved to the right and down, then to the right and back up, // and finally the left mouse button will be released.
Rectangle screenRect =
   (Rectangle) drawingWindow().getProperty(".screenRectangle");
Point origin = new Point(screenRect.x + 5, screenRect.y + 5);
LowLevelEvent llEvents[] = new LowLevelEvent[7];
llEvents[0] = mouseMove(atPoint(origin.x, origin.y));
llEvents[1] = leftMouseButtonDown();
// insert a delay to provide the SUT with time to respond
// to the events being delivered to it.
llEvents[2] = delay(250);
llEvents[3] = mouseMove(atPoint(origin.x + 25, origin.y + 50));
llEvents[4] = delay(250);
llEvents[5] = mouseMove(atPoint(origin.x + 50, origin.y));
llEvents[6] = leftMouseButtonUp();

A Functional Tester, VB.NET Scripting example to test a TrackBar control and confirm the control responds to the mouse wheel events:

' This will test a TrackBar control to make sure
' that it responds to mouse wheel events.
TrackBar1Slider().Click(AtPoint(0, 0))
' Create a Low Level Event representing scrolling
' the mouse wheel down 25 clicks.
Dim ScrollDown As LowLevelEvent = MouseWheel(-25)
' Verify The Results.