English|Deutsch
Subscribe Ranorex Announcements Feed Ranorex LinkedIn Ranorex twitter Ranorex Facebook

Frequently Asked Questions

Is there a way to use text patterns in Ranorex search methods?

You can use Ranorex Regular expressions. These expressions are text patterns that are used for string matching. Regular expressions are strings that contains a mix of plain text and special characters to indicate what kind of matching to do. You can use Regular Expressions with the enumerator SearchMatchMode.RegExp in Ranorex.

Suppose we are looking for a form with a name "Sample" and a numeric digit e.g. "Sample3". The regular expression we would search for is "Sample[0-9]". The brackets indicate that the character being compared should match any one of the characters enclosed within the bracket. The dash (-) between 0 and 9 indicates that it is a range from 0 to 9. Therefore, this regular expression will match any character between 0 and 9, that is, any digit. If we want to search for a special character literally we must use a backslash before the special character. For example, the single character regular expression "\*" matches a single asterisk.

How can I stop an active automation process?

Define an action key to stop your automated process. An action key is a key combination that the user can press to perform a special action. For example, a user can create an action key that exits a running script. Use the SetActionKey function to activate a key combinationan for an action. You can retrieve the specified key combinations with the GetActionKey function. Whenever the user presses the action keys, from any part of the system, the action will be started. The action key remains valid until the script is running.

Is it possible handle exceptions with Ranorex?

Exceptions in RanorexPro can be devided in to two categories:
  • Bugs (i.e. RanorexNet API misuse), or system failures (e.g. ArgumentException, NullReferenceException,)
  • Exceptions that signal, that a test operation couldn't be performed correctly
We don't suggest to catch exceptions from the first type. Only catch the specific Ranorex.Exceptions. If a bug in your code manifests itself as an exception, then it's best to let the test application terminate right at the point of failure. When the bug is discovered, you'll get exactly the diagnostic information you need to fix it quickly and move on.

If you write exception handling code, catch all Ranorex.Exceptions:

C#

try
{
    Application.ErrorAsException = true;
 
    form = Application.FindFormTitle("RanorexTestedApp");
 
    Button button1 = form.FindButton("button1");
    Mouse.ClickControl(button1);
    ...
    Console.WriteLine("TEST PASSED");
}
catch (RanorexException e)
{
    Console.WriteLine("EXCEPTION Source={0} Sender={1} Message={2}
              StackTrace={3}", e.Source, e.Control, e.Message, e.StackTrace);
    Console.WriteLine("TEST FAILED");
}

How can I install Ranorex within the global assembly cache?

If you want to make RanorexNet globally accessible then you have to place the assemblies RanorexNet.dll and RanorexSpy.dll into the Global Assembly Cache. (The folder is dependent on the version of Visual Studio that you have installed and whether or not you installed it to the default path, so you may need to adjust it as needed for your system.)
  1. Open a command line window
  2. Navigate to the folder: "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin"
  3. Deploy the assemblies to the GAC using the gacutil command:
    gacutil /i C:\Ranorex-1.1.0\Bin\Net-2.0-Pro\RanorexSpy.dll
    gacutil /i C:\Ranorex-1.1.0\Bin\Net-2.0-Pro\RanorexNet.dll
  4. Copy the assemblies RanorexNet.dll and RanorexSpy.dll in the folder
    "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies"
    (This adds the assemblies to the Add References dialog of Visual Studio 2005)
  5. Copy RanorexCore.dll into the Windows\System32 folder

I have started test automation development with Visual Studio. Is it possible to migrate existing projects to Ranorex Studio?

Ranorex Studio supports to open projects based on Visual Studio 2003 and Visual Studio 2005.

What is difference between Control and Element based automation?

Controls are the primary Windows GUI objects which are identified at runtime by a window handle. Every type of control enables some other kind of user interaction at a different level of complexity, e.g. a label just shows some information whereas the more complex ListView may also be used to select an item or display its items in various styles.

The more complex controls (just like the ListView) may be divided into smaller GUI objects that we call elements. An element can, for example, identify the column headers in a ListView or a distinct ListView item. Every element is assigned a role, e.g. “ListItem” or “ColumnHeader”, from a predefined list of possible roles that describe how the user can interact with an element.

Are there known issues using Ranorex on Windows Vista?

Taskbar thumbnails:
You should disable the taskbar window preview thumbnails since they have the same name as the previewed window and could therefore interfere when searching for top-level windows by title. Just uncheck the "Show windows previews (thumbnails)" checkbox in the "Taskbar and Start Menu Properties" (opened by right-clicking on the taskbar and selecting the Properties menu item).

Internet Explorer - Protected mode:
If you're doing web automation with RanorexNet, you need to disable the Internet Explorer "Protected mode", unless you run the code with administrator rights. To do that double-click on the "Protected Mode: On" label in Internet Explorer and uncheck the "Enable Protected Mode" checkbox in the Internet Security popup (requires restart of IE).

Administrator privileges:
For Ranorex 1.4 and previous versions you need to have administrator rights to run RanorexRecorder and to execute Ranorex code with the evaluation version. This issue will be fixed in the 1.5 release.

User Account Control (UAC):
For Ranorex version 1.3 and prior you need to disable UAC to get the RanorexRecorder working. This can be done in the Control Panel->User Accounts setting by clicking on the "Turn User Account Control on or off" button (requires restart).