Script Recording
Script recording is a feature introduced
for the first time in VNCRobot 1.2. It allows you to record everything
you do in the VNC viewer to the active editor and easily create
automated testing scripts.
To start/stop script recording select/deselect Script -> Record in the VNCRobot menu or
the
button on the tool bar.
Component which provides this feature is called Recording Module. It is
capable to capture and record user actions such as:
- Mouse events like mouse moves, mouse clicks
and mouse drags,
- Keyboard events, which represent most
combination of keys you can press on your keyboard.
The following chapters describe functionality of the recording module
and discuss how to configure and customize its behavior.
General Rules
The recording module maps the key and mouse events as well as their
timeline onto commands of the VNCRobot
1.3 scripting language. Commands are always inserted into current
caret position of the active editor.
Time spans between single commands are captured through the 'wait
'
command parameters or Wait
commands where the parameter is not supported. If you e.g. perform a
mouse click while the recording feature is on, a command like the one
below appears in your active editor:
Mouse click to=x:253,y:132
Wait a while and perform another mouse click. The code will look like
this:
Mouse click to=x:253,y:132
wait=3400
Mouse click to=x:355,y:144
Note that the first command was updated with the 'wait
'
parameter. Its value represents the time elapsed between the mouse
clicks in miliseconds. When the preceding command doesn't support the 'wait
'
parameter (e.g. Screenshot
or Report
commands), the recording module rather produces a Wait
command:
Screenshot init.jpg desc="Initial
remote desktop state."
Wait 3400
Mouse click
to=x:253,y:132
Preceding Waitfor
commands are never updated this way because their 'wait
'
parameters may be related to multiple updates. See the Waitfor Command Window page for more
information.
To track the time spans the module maintains a timer which measures
time from the last user action (i.e. from the last time it inserted or
updated a command in the editor). This timer runs only if the VNC viewer
is active, i.e. your mouse pointer is within its bounds. If you move
your mouse pointer out of the remote desktop, the timer stops and it
won't start ticking until you move the mouse pointer into its bounds
again. This feature allows to exclude the time you spend on other tasks
like manual script editing and using of other tools. Remember to move
your mouse pointer out of the remote desktop if you are going to do
something else to prevent the module from introducing of large wait
times into the script commands.
Mouse Event Recording
Mouse pointer events are recorded as follows:
- Mouse moves generate
Mouse move
commands
into the active editor. As recording of every tiny mouse move would
produce a lot of code, mouse move commands are rather created only after
you stop the mouse pointer for a certain period of time. This timeout is
by default set to 300 miliseconds and can be customized in the
Preferences window.
- Mouse clicks insert
Mouse click
commands
into the active editor. Two subsequent clicks are recognized as
double/multiple clicks if their time span does not exceed configured
delay. Default value is 300 miliseconds. You can customize this value in
the Preferences window.
- Mouse drags produce
Mouse drag
commands.
Recording of each of the mouse event types described above can be
disabled in the Preferences window. See
the following screenshot. If you want e.g. to have a shorter and simpler
test script code, you can disable recording of the mouse move events.
You must then avoid any desktop actions which are triggered by mouse
moves. A typical example is the Start menu in MS Windows which displays
submenus depending on mouse moves. Such actions will not record if mouse
moves are disabled and your script will fail to reproduce the required
behavior.

Keyboard Event Recording
Keyboard events are recorded as follows:
- If the key you press is an action or control key (e.g. Alt+S, F1,
Enter, etc.), a
Press
command is produced. If the same key is pressed within a certain period
of time, it is considered to be a multiple press and VNCRobot produces a
single Press command with the 'count
' parameter set to the
number of pressed keys. This delay is by default set to 400 miliseconds.
- Any other characters will be concatenated to a text and a
Type
command is
produced. If you type a text and press Enter, a Typeline
command
is created rather than two separate commands 'Type <text>
'
and 'Press Enter
' provided that the Enter key is pressed
within a certain time period after the last text character. This timeout
is by default set to 1 second.
All parameters described above are configurable in the Preferences window. See the following
screenshot.
