Using OCR to Work with Graphical Text

QA Wizard Pro uses optical character recognition (OCR) technology to read graphical text in applications and convert it to text strings.

You can use the OCRGetText statement to return text from images, control types QA Wizard Pro cannot recognize, or a specified region in a window or control for use in other statements. Other OCR statements are also available to perform different OCR actions, such as checkpoints. See OCR statements.

Some OCR statements use a specific region relative to a window or control to find graphical text in applications. To provide the most accurate region to check, use the Add Statement dialog box to add OCR statements.

Note: The following information shows how to add the OCRGetText statement. Steps for adding other OCR statements are similar.

1. Select the script line above where to add the statement.

2. Choose Script > Add Statement.

The Add Statement dialog box opens.

3. Select OCR Get Text in the OCR category.

4. The Application/version field is automatically set with the context. This information is used to populate the Window and Control fields on the Add Statement dialog box with values from the application repository. See Script.SetContext.

If QA Wizard Pro cannot identify the context, None is selected. This usually occurs when you add statements to a utility script that is only called by other scripts because the context is set in the script that calls it. If an application/version is required, select it from the list.

5. Select the Window to check for text in.

A screenshot of the selected window is displayed.

6. If you are checking for text in a control, select the Control.

The selected control is outlined with a red box in the screenshot.

7. Enter the OCR Region information to specify where to find the text.

These fields are automatically populated based on the location and size of the selected window or control. You can also click the screenshot and drag the red rectangle to select the region to use, which updates the values.

8. Click Test to make sure the expected text is found before adding the statement to the script.

A dialog box opens and displays the found text.

By default, the OCR playback options are used when reading graphical text. If the found text is incorrect, you can adjust the default contrast, image scale, and grayscale conversion options to improve the accuracy of found text and change the OCR language file to identify non-English characters before adding the statement. See Setting playback options.

Note: OCR technology is not exact. See Troubleshooting OCR issues for tips that can help provide best results.

9. Click OK to close the test dialog box.

10. If you are adding a function, select an optional Output variable to assign the return value to.

The list includes script variables declared before the current line and repository variables for the application. To create a new variable, enter a variable name.

11. Enter an optional Comment, such as the purpose of the statement.

12. Click OK to add the statement to the script.