Modify QuickTest Professional Text Recognition behavior

By default, when QuickTest Professional captures text for a text/text area checkpoint or output value step using the GetText, GetTextLocation, or GetVisibleText methods, it tries to retrieve the text directly from the object using a Windows API-based mechanism. If QuickTest Professional cannot capture the text this way (for example, because the text is part of a picture), it tries to capture the text using an OCR (optical character recognition) mechanism provided by ABBYY Software Ltd.

Changing QTP 10.00 or higher default text recognition behavior
Additional configuration settings have been incorporated in QTP 10.00 for the text recognition mechanism. It can now be modified from the “Tools -> Options…” dialog under the “General > Text Recognition” section. Alternatively, as in previous versions, these settings can also be modified from Windows Registry Editor as described below. Changing QTP 9.2/9.5 default text recognition behavior
The default behavior of QuickTest Professional 9.2/9.5’s text recognition mechanism can be changed by modifying values in the registry.

The Windows Registry Editor is an advanced tool for changing settings in your system registry. You should not edit your registry unless absolutely necessary. If there is an error in your registry, your computer may not function properly.

The text recognition behavior is controlled by the values in the HKEY_CURRENT_USER\SOFTWARE\Mercury Interactive\QuickTest Professional\MicTest\OcrEngine registry key.

The following table lists the possible value entries for the OcrEngine key. Name

Possible Values


1 -Enabled. This instructs QuickTest Professional to use the OCR mechanism according to the mode value. (Default)
0 – Disabled. QuickTest Professional will not use the OCR mechanism regardless of the mode value. (Same as setting the mode value to 0 – No OCR.)


Indicates the height or width of the text block in pixels, for example, 29. Modify both value entries to instruct the OCR mechanism to treat the object as a single text block.

Sometimes, text on small objects or in a small text area is not captured (or is captured incorrectly). In cases such as these, specifying the maximum text area size in pixels may help improve text recognition. This causes the OCR mechanism to focus on a specific area and treat it as a single text block (and not as multiple text blocks, as it would normally do).

Tip: You can use QuickTest Professional’s Object Spy to find the height and width of the object.

Default for both = 0 (indicates multiple text block)


0 – No OCR. Instructs QuickTest Professional to use only the Windows API-based mechanism (and not the OCR mechanism) to retrieve text from the object.
1 – Windows API/OCR. Instructs QuickTest Professional to first try to retrieve text directly from the object using the Windows API-based mechanism. If no text can be retrieved, QuickTest Professional tries to retrieve text using the OCR mechanism. (Default) (Highly recommended when working with CJK languages.)
2 – OCR/Windows API. Instructs QuickTest Professional to first try to retrieve text from the object using the OCR mechanism. If no text can be retrieved, then QuickTest Professional uses its Windows API-based mechanism to retrieve text from the object.
3 – OCR only. Instructs QuickTest Professional to use only the OCR mechanism (and not the Windows API-based mechanism) to retrieve text from the object. (Required when working with Windows Vista.)


Indicates the language dictionaries that the OCR mechanism uses when retrieving text from the object.
Enter a comma to separate the languages, for example: English, German, Spanish, French

Combined hieroglyphic languages (CJK – Chinese, Japanese, or Korean) and non-hieroglyphic languages are not supported. For example: English, Japanese


Indicates the path of the .ini file containing the customized profile for the OCR mechanism.

If the OCR mechanism cannot retrieve any text from the object, you can fine tune its settings to help it recognize the objects in the application being tested. You do this by creating an .ini file containing a customized profile with the required property settings which will help overcome issues relating to, font, font size, and contrast. This .ini file must be in ABBYY FineReader format.

Note: Although these text-capturing options and methods are now available for Windows-based objects, keep in mind that any text-recognition mechanism may occasionally capture unwanted text information (such as hidden text and shadowed text), or may misinterpret the text content.

Additionally, text-capturing steps may behave differently in different run sessions depending on the operating system version you are using, the installed Service Packs, other installed toolkits, the APIs used in your application, and so on.

Therefore, when possible, it is highly recommended to check text from your application window by inserting a standard checkpoint, output value, or GetROProperty method for the object containing the desired text to retrieve the value of its text (or similar) property.

For more information, refer to the relevant sections in the QuickTest Professional User’s Guide, and search for the GetText, GetVisibleText, and GetTextLocation methods in the relevant sections of the QuickTest Object Model Reference Help.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s