Perform text analysis

You can use the text analysis feature for advanced verification of textual elements on the screen.

Text analysis is based on optical character recognition (OCR) and provides the ability to validate the presence (or absence) of any textual element in different forms (full, partial, and so on).

With the text analysis feature, you can:

  • Specify parameters for advanced analysis.

  • Test the effect of parameters on the analysis. The result indicates the percentage of confidence to find the needle in the haystack. In this context, the needle is the text that you are searching for and the haystack is the search area on the device.

To learn how to perform text analysis, watch this video or review the instructions following the video.

Configure and run text analysis

Perform the following steps to configure and run text analysis.

To configure and run text analysis:

  1. In the widgets pane, click the Automation button .
  2. On the Automation tab, click Text Analysis.
  3. In the Text Analysis widget, do the following:
    1. From the Command list, select a command to insert into your test. For more information, see Available commands.

    2. Enter the text you expect to find.

    3. (Optional) To specify additional parameters, click Advanced parameters and enter the parameter values as needed.

      For more information, see Available parameters.

    4. To see how likely it is that the test will find the text on the screen with the current configuration, click Try.

      In the Result field, the test result appears as a percentage that indicates the likelihood of finding the text. If the likelihood is low, you might have to adjust the test parameters.

    5. Next to the APPLY button, select the required checkbox next to these options:

      • Execute the selected action on the device.

      • Add the selected action to the test.

    6. Click APPLY.

    7. (Optional) At the top, click Back to return to the Automation tab.

Available commands

The following table describes the commands available in the UI. For more information on these commands, see Visual analysis functions.

Command Description Code Snippet (Java)

Find

Finds the text or image (needle) on the device screen (haystack) and stores the coordinates for future commands. See also Find text (FR) and Find image (FR).

mobile:text:find
mobile:image:find

Button

Identifies a button, based on a text or image label, and clicks it. This command includes an integrated platform-specific OCR customization. See also Text button click (FR) and Image Button Click (FR).

mobile:button-text:click
mobile:button-image:click

Edit-get

Identifies an edit field, based on a text or image label, and retrieves its text value. The value is returned as a string. See also Edit-text get (FR) and Edit-image get (FR).

mobile:edit-text:get
mobile:edit-image:get

Edit-set

Identifies an edit field, based on a text or image label, and inserts the specified text or image in the value parameter into the field. The field is in relation to the found label. It is defined by the label position and offset parameters. See also Edit-text set (FR) and Edit-image set (FR).

mobile:edit-text:set
mobile:edit-image:set

Available parameters

The following table describes the parameters available in the UI and their values. These parameters address the most common use cases. For more information about these parameters and about additional parameters that apply to more advanced use cases, see General Visual Analysis Parameters.

Parameter Subparameter Description Values

Haystack

 

Use to limit the area of the screenshot (haystack) examined by providing the coordinates of the top-left corner of the haystack rectangle and the rectangle's dimensions. This is especially useful if the image or text that you are looking for is known to appear in a particular area of the screen, such as the header or footer.

To define the haystack, you can:

  • Drag the pointer over the device screen and, if needed, fine-tune the area using the Left & Top (%) and Width & Height (%) fields in the form.
  • Specify the offset of the search area from the top and left as well as the width and height of the search area, in percent.
Important: If you specify a value other than 0 in the Top or Left field without adjusting the height or width accordingly (which are, by default, set to 100%), an error occurs.

For example, in the following image, the search area is defined as offset by 25% from the left and 0% from the top, with a width of 50% and a height of 10%.

The offset from top and left as well as width and height, in percent or pixels

Relative position

 

Only available with the Button command selected. Use to specify the position of text relative to the button and the text distance from the button, in percent. 

Above, Below, Left, or Right

Distance in percent

Timeout (secs)

 

Use to define the time, in seconds, to wait for a needle to appear on the device screen. This is useful with a dynamic screen where the page loading time should be considered when searching for the needle.

Restriction: When enabling scrolling, the timeout must be zero. Scroll cannot be used with a positive timeout value because this command dictates a different behavior when the needle is not found. Also, using a scroll results in longer execution times.

Time, in seconds

Accurate Timer

 

Add to specify the accuracy level of the timer. Turn on for a measurement in sub-seconds (0.1 seconds, which is accurate). Turn off for normal accuracy, in seconds (considered rough). 

On/off

Threshold (%)

 

Use to specify the acceptable match level percentage, between 20 and 100.
Values that are too low can lead to a false positive result, while values that are too high can lead to a false negative result.

20-100

OCR Profile

 

(Text analysis only) Use to set optimal values for a large number of OCR parameters to match a particular scenario. We highly recommend setting a profile due to profile complexity and the large number of parameters involved.

For details, see What are OCR profiles?.

  • Default
    Document Conversion Accuracy
  • Document Conversion Speed
  • Document Archiving Accuracy
  • Document Archiving Speed
  • Book Archiving Accuracy
  • Book Archiving Speed
  • Text Extraction Accuracy
  • Text Extraction Speed
  • Field Level Recognition
  • Barcode Recognition

Languages

 

(Text analysis only) Use to specify the OCR language to use. You can select multiple values.

This parameter is irrelevant when using the native screen source.

English, Spanish, Japanese, German, French, Dutch, Italian, Chinese, Russian, Portuguese

Scroll and Search

 

Turn on to specify whether to scroll until the label is found. Scrolling results in a longer execution time.

You cannot use this parameter together with a positive timeout value. When scrolling is enabled, the timeout value must be zero.

On/off

Max scroll

The maximum number of scroll actions to perform before returning (default 5).

0-100

Next

Specifies how to perform the scroll action. Basic directions are swipe up, swipe down, swipte right, and swipe left.

Swipe Up, Swipe left, Swipe down, Swipe right

Ignore Case

 

(Text analysis only) Use to specify case sensitivity of the search pattern. When turned on, the search is not case sensitive.

On/off

Whole Word

 

(Text analysis only) Turn on to match only whole words in the haystack. Otherwise, also part of other words are found.

On/off

 

Match Mode

 

The needle comparison method.

Contain - needle is part of the haystack

Equal - needle is equal to the haystack

Start with - haystack text begins with the needle

End with - haystack ends with the needle

First - first occurrence of the needle

Last - last occurrence of the needle

Index - defined occurrence of the needle, used alongside the Index parameter

contain (Contain)

equal (Equal)

startwith (Start with)

endwith (End with)

first (First)

last (Last)

index (Index)

Index   In case the needle has multiple occurrences on the screen, enter the index of the required occurrence. 1 (default value)
Exact Phrase   The option to find the exact needle phrase with no errors. This parameter is not relevant when using native screen source. True/False

Ignore White Space

 

(Text analysis only) Turn on to ignore spaces within search pattern words.

On/off

Match

 

(Image analysis only) Use to specify the needle comparison method, where:

  • Identical means that the needle and haystack are from the same origin (device screen) and size. This makes matching faster and simpler.
  • Similar means that needle and haystack are not from the same origin (needle is from another device or other source) or not the same size (different ratio or size). This makes matching slower and more complex. Because analysis time increases, make sure to adjust timeout values when using this value.
  • Bounded means the same as Similar, but with a restriction on the possible needle sizes. This value allows you to decrease the Similar analysis time by using preexisting knowledge about the needle size or by decreasing the size of the haystack.

Identical, Similar, or Bounded