Ranorex

English|Deutsch

Ranorex Recorder

print friendly page

Using Ranorex Recorder

Prerequisites for using Ranorex Recorder

Ranorex Recorder on Windows Vista: UAC (User Account Control) has to be turned off. Turn UAC off using MSCONFIG. Just start up MSCONFIG.EXE, click the last tab, and there you can turn UAC off (and back on again). You'll have to reboot for this change to take effect.

Visual C++ Runtime Libraries:
The Recorder requires some C++ runtime libraries.
Please install the Visual C++ Redistributable Package (VCRedist_x86.exe) if you get this error:

"This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix the problem."

This package is 2.6MB in size and will install the Visual C++ libraries on your machine.
It can be downloaded from the Microsoft download site at:
Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)

Recording and replaying user actions

1. Record user actions

Click the "Record" button to start recording.
Record mouse movements and keyboard inputs

After the Recorder window has been minimized, the icon on the system tray starts to rotate. Now you can perform the recording actions like starting an application, mouse clicks or keystrokes.

Note: The Recorder records mouse clicks but no mouse moves! For that you'll have to click on each item to record each action. To start, for example, the Windows Explorer you'll have to do following steps:

  • Click on "Start"
  • Click on "Programs"
  • Click on "Accessories"
  • Click on "Windows Explorer"

2. Stop recording

To stop recording, press the "SHIFT" + "ESC" key or switch back to the RanorexRecorder. The collected information will be displayed on the "Actions" tab.

3. Replay recorded data

By clicking the "Play" button, all recorded data will be replayed. The Recorder window will be minimized and a green animated icon is shown in the system tray. Use the "Speed" slider bar to choose the speed of the replay. The default speed is real time or 1.0. The speed ranges from 0.1 through 10.0 times real time. The "Cycle" value determines how many times the recording will be repeated. The replay operation can be stopped with the "SHIFT + ESC" shortcut.

Viewing recorded data

After a recording operation the collected data will be shown in the action tab. The first line shows information about the form, the second line about the control and the third line about the active elements. The XML tab shows the same information as an XML document. The C# tab automatically shows the generated C# source code.

Note: the generated code only works with RanorexPro version 1.2 or above.

Deleting Actions

To delete recorded actions from the "Actions" tab select one and press the "Delete Action" button.

Note: after deleting an action it is necessary to replay all actions again to update source codes and XML data.

Saving and loading recorded data

The Ranorex Recorder provides different types of file export by selecting the "Save" button.
  • Project file (XML-based)
  • Code files (C#, C++, Python)
  • Executable (*.EXE)
The project file (XML) stores all user actions and settings like “Speed” or “Cycle” count. To reopen recorded projects use the “Open” button. Export the source code in your preferred language using the checkboxes for C#, C++ or Python. When the "Exe" option is checked, an executable file containing the automation script is generated that may be started independent of Ranorex Recorder within your build or automation system. All files are saved with the specified name and in the specified location.

Collected Information

The Recorder collects the following information for every user action:

Active window properties

  • title text
  • class name
  • handle
  • mouse position (the positions are given in client coordinates that are relative to the upper-left corner of the window)
Active control properties
  • name
  • text
  • control ID
  • class name and instance number
  • handle
  • mouse position (the positions are relative to the upper-left corner of the control)
Active element properties
  • role
  • name
  • class name
  • position (the positions are given in client coordinates that are relative to the upper-left corner of the window)
  • mouse position (the positions are relative to the upper-left corner of the element)
Keystrokes with delays in typing

Using the generated code

You can copy the code into your existing test application or you can compile it directly with a C# or C++ compiler or start the Python interpreter.

You do not need Visual Studio to compile the generated code. You can call the C# or C++ compiler from a batch file and generate an executable:

SET CSCEXE="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc"
call %CSCEXE% /out:test1.exe /r:RanorexNet.dll test1.cs
call test1.exe

Batch sample for C++

cl /I ..\..\Include  /Fetest1.exe  test1.cpp /link /LIBPATH:..\..\lib oleacc.lib ranorexcore.lib
call test1.exe

The Python interpreter can also be started directly:
call Python test1.py

Using the generated executable

The generated executable can be started directly. It contains all needed components and the .exe runs in all Windows versions. The executable is only dependent on six Windows libraries, all of them are part of the Windows operating system.

The .exe is a Win32 console application but it doesn't open a command line box. It exits with 0 if successful, otherwise 1.

The executable cannot be opened or modified with the Recorder.

Using the XML file

The recorded data can be saved and re-opened as an XML file.
You can replay the recorded data with the Recorder from command line as follows:

RanorexRecorder.exe test1.xml

Batch sample for C#