# Tips & tricks - OCR methods (Windows only)

Capture visible text from within a specific object in your application using the GetVisibleText and GetTextLocations methods, available for all test objects.

You can also capture an image of any part of your application and then use the GetText and LocateText methods of the ImageUtils class to capture text from within a supplied image.

These methods use an OCR (optical character recognition) mechanism to capture text. Therefore, keep the guidelines below in mind when using these methods.

## Getting an object's text

For test objects that support it, get an object's text using the text property (C#) or getText method (Java) or similar.

These programmatically retrieve the object's text.

Use the OCR methods only when these methods of retrieving text are not available.

Back to top

## Using OCR methods

When using OCR methods, results are best for standard fonts with a letter size of at least 10pt, and with high contrast (black letters on white background works best).

Back to top

## Specifying text area in OCR methods

When specifying the text area in OCR methods, try to keep the dimensions of the rectangle as small as possible. This helps prevent unwanted characters in captured text.

However, keep in mind that the operating system, installed service packs, installed toolkits, and so on, can affect the size and location of an object in an application. Make sure that the dimensions of the selected text area are large enough to account for different system configurations.

Back to top

## Windows themes

Set your Windows theme to use a well-contrasted color schema and without color gradients.

Back to top

See also:

- Tips and tricks - General
- OCR code samples (.NET)
- OCR code samples (Java)
- Blog post: Image and Text Recognition Utilities for easier Continuous Testing

https://admhelp.microfocus.com LeanFT 8942
Tips to improve your search results...TOC Lean Functional Testing Help Center LeanFT Help Center 14.50 - 14.53 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version:(Undefined variable: _rscC_Basic_Variables.FloatingTocShow)