Find text command

Locates the test specified by the content parameter and stores its coordinates on the device for future use by other operations. Note that these coordinates are not sent back as return value.

This command is used as the first step in a Visual Relationship sequence:

  • Perform Find text to identify the location of the string on the screen.
  • Perform a text visual analysis command using the visual relation parameters to identify the element relative to the text identified with the Find text execution.

Parameters

Name Type Possible values Description

Device ID*

Device

 

The device for this command. By default, this is the device under test (DUT).

Expected text (needle)*

Media

 

The device for this command. Consider using the entire string searched for, to ensure that if the OCR misses a few characters, the needle will still be found.

The text-match algorithm is less error-prone when the provided string is longer.

Search area (haystack)

String

all | body

Defines the screen region where to look for the needle.

Analysis source

String

Primary | Native | Camera | Auto

The source for retrieving the screen content, where:

  • Primary takes the screenshot from the device (higher resolution but slower)

  • Native uses native device controls

  • Camera takes the screenshot from the video stream (lower resolution but faster)

  • Auto uses native device controls, if available. If not available, a digital screen image is used, if available. If not availabe, an analog screen image is used.

Target

String

As is | Any

The target search in case the needle includes more than one word, where:

As is searches for the entire string content as is, as a complete phrase

Any searches for any word in the string. When selecting Any, the words in the Expected text parameter can be divided into phrases with quotation marks. For example: "new contact" "add contact"

Timeout

Number

 

The time, in seconds, to wait for the text to appear.

For a dynamic screen, specify the expected waiting time for the text to appear. Example: page load time

The timeout contains the system analysis time. For this reason, consider specifying at least 20 seconds.

Timer accuracy

Number

Rough | Accurate

The timer accuracy level, where rough is normal accuracy (seconds) and accurate is sub-second (0.1 second).

To use this parameter, the Screen source parameter must be set to Camera.

Threshold

Number

 

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.

Label position

String

Inside | Above | Below | Left | Right | Leftmost | Rightmost

The label position relative to the button. Used alongside the label.offset parameter. Rightmost and leftmost label position values represent the distance from the screen edge.

  • Inside: The label is part of the button.

  • Above: The label is above the button.

  • Below: The label is below the button.

  • Left: The label is to the left of the button.

  • Right: The label is to the right of the button.

  • Leftmost: The button is aligned to the right, and its label is to the left.

  • This parameter is not relevant when using native screen source.

  • Rightmost: The button is aligned to the left, and its label is to the right.

  • This parameter is not relevant when using native screen source.

For native screen source, the default position is the native control closest to the label. If a label position is specified, the search region is limited to what was selected.

Label offset

String

 

The value can be in pixels or in percentage of screen height (0-100). For percentage, use the % sign. Example: 20%

Used alongside the Label position parameter. If the label position is "none," then the label offset is "0." Otherwise, the label offset default is 10%.

OCR - Profile

String

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

Use when text cannot be found on the device screen.

Try all the profiles with the word accuracy. Per profile, try changing the DPI (96 or 300 or 120).

OCR - Analysis mode

String

Full | Automatic | Manual

The image analysis mode.

The device screen may contain text and images.

  • Automatic: OCR distinguishes between text and images, filtering out images.

  • Manual: OCR assumes text only. Use alongside the Inverted text parameter.

  • Full: OCR tries both automatic and manual.

This parameter is not relevant when using native screen source.

OCR - Inverted text

String

Any | Yes | No

The text appearance, likely to appear in inverted colors (dark text on light background). Use only if Analysis mode is set to Manual.

  • Yes: Text is inverted.

  • No: Text is normal (not inverted).

  • Any: Text might be inverted or not, checked automatically by the system.

OCR - Languages

String

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

The OCR language to use. It is possible to select multiple languages.

For languages that do not appear in the drop down menu, contact Perfecto Support to enable them.

This parameter is not relevant when using native screen source.

OCR - Policy

String

Auto | Accuracy | Performance

The text recognition accuracy policy. Selecting the Accuracy value will increase the operation time.

  • Auto: Shifted toward recognition accuracy with a moderate impact on the recognition speed.

  • Accuracy: Shifted toward maximum recognition accuracy.

  • Performance: Shifted toward recognition speed.

This parameter is not relevant when using native screen source.

Haystack top

String

 

The top value of the screen area where to search for the label.

Values can be in pixels or in percentage of screen width (0-100). For percentage, use the % sign. Example: 20%

Default is to search the entire screen.

Consider using the percentage value because it does not rely on the screen resolution.

Haystack height

String

 

The height value of the screen area where to search for the label.

Values can be in pixels or in percentage of screen width (0-100). For percentage, use the % sign. Example: 20%

Default is to search the entire screen.

Consider using the percentage value because it does not rely on the screen resolution.

Haystack left

String

 

The left value of the screen area where to search for the label.

Values can be in pixels or in percentage of screen width (0-100). For percentage, use the % sign. Example: 20%

Default is to search the entire screen.

Consider using the percentage value because it does not rely on the screen resolution.

Haystack width

String

 

The width value of the screen area where to search for the label.

Values can be in pixels or in percentage of screen width (0-100). For percentage, use the % sign. Example: 20%

Default is to search the entire screen.

Consider using the percentage value because it does not rely on the screen resolution.

Duration

Number

 

The minimum time interval, in seconds, for a single analysis.

If the analysis operation takes less than the interval, wait the remaining time before the next analysis operation.

Interval

Number

 

The minimum time interval, in seconds, for a single analysis.

If the analysis operation takes less than the interval, wait the remaining time before the next analysis operation.

Backlight

String

 

The key sequence to perform the backlight operation.

Example: VOL_UP

For best practice, use a key that will not change the screen.

Scroll and search

String

False | True

Scrolls until the label is found. Scroll cannot be used together with a positive timeout value because the parameters dictate a different behavior when the needle is not found. When scrolling is enabled, the timeout must be zero.

Scroll results in a longer execution time.

Max scroll

Number

 

The maximum number of scroll actions to perform before returning.

Finding the label will stop the scrolling.

Effective values are in the range of 0-100.

Next

String

SWIPE_UP | SWIPE_DOWN | SWIPE_RIGHT | SWIPE_LEFT | UP | DOWN | RIGHT | LEFT

The key sequence to perform the scroll operation.

For more information see Swipe Gesture in Analysis Functions.

Use cache

String

Use | No Use

Indicates whether the text recognition application should use a cached picture of the screen if available (this value should not be changed by the user, under normal circumstances).

Match mode

String

Contain | Equal | Start with | End with | First | Last | Index

The needle comparison method.

  • Contain: The needle is part of the haystack.
  • Equal: The needle is equal to the haystack.
  • Start with: The haystack text begins with the needle.
  • End with: The haystack ends with the needle.
  • First: The first occurrence of the needle.
  • Last: Last occurrence of the needle.
  • Index: Defined occurrence of the needle, used alongside the Index parameter.

Index

Number

 

If the needle has multiple occurrences on the screen, enter the index of the required occurrence.

Whole-words search

String

False | True

Specifies whether the search matches only whole words in the haystack or also partial words.

For example: Defines whether 'person' in 'personal' is a good match or not.

  • True: Matches the whole needle words in the haystack

  • False: Matches the whole or sub-string words in the haystack

Ignore case

String

True | False

Specifies the search pattern case sensitivity.

  • True: Insensitive

  • False: Sensitive

Ignore whitespaces

String

True | False

Specifies whether to ignore spaces during search pattern words.

  • True: Ignores spaces

  • False: Does not ignore spaces

Ignore punctuation

String

True | False

Specifies whether to ignore punctuation characters when matching text.

  • True: Ignores punctuation

  • False: Does not ignore punctuation

Exact phrase

String

 

Specifies whether to find the exact needle phrase with no errors.

This parameter is not relevant when using native screen source.

Report

String

All | All on error | Screenshot | Screenshot on error | Text | None

The value to display in the report.

  • Screenshot: Display a screenshot

  • Screenshot on error: Display screenshots only for actions in error.

  • Text: Display screen text.

  • All: Display screenshot and text.

  • All on error: Display text always and screenshots only for actions in error.

  • None: Display nothing.

Consider reducing the resolution in very long scripts that result in large report files.

Report image resolution

String

High | Medium | Low

The image resolution.

Consider reducing the resolution in very long scripts that result in large report files.

Grid label

String

 

The column name to be used for grid view in the report.

Selecting this parameter creates the grid report.

Visual relation direction

String

Left | Right | Above | Below | Left-Above | Left-Below | Right-Above | Right-Below | Inside

The direction of the related region, stored in memory from the last found needle, in relation to the searched needle.

For more information, see the Visual Relations series.

  • Left: The related region is to the left of the searched needle.

  • Right: The related region is to the right of the searched needle.

  • Above: The related region is above the searched needle.

  • Below: The related region is below the searched needle.

  • Left-Above: The related region is to the left and above the searched needle.

  • Left-Below: The related region is to the left and below the searched needle.

  • Right-Above: The related region is to the right and above the searched needle.

  • Right-Below: The related region is to the right and below to the searched needle.

  • Inside: The searched needle is inside the related region boundaries of the related region.

Visual relation inline

String

Horizontal | Vertical

The search area is in line with the related region, stored in memory from the last found needle.

For more information, see the Visual Relations series.

  • Horizontal: The needle is within the height (top to button) boundaries of the related region.

  • Vertical: The needle is within the width (left to right) boundaries of the related region.

Horizontal alignment

String

None | Left | Center | Right

The horizontal alignment, where:

  • None does not check for horizontal alignment

  • Left indicates that the needed should be left-aligned

  • Right indicates that the needle should be right-aligned

  • Center indicates that the needle should be center-aligned

Horizontal alignment accuracy

String

 

The amount of allowed accuracy to still match the required alignment. For example, if 10% is used and the target is located at position 15 out of 320, thenn the validation succeeds.

Vertical alignment

String

 

The vertical alignment, where:

  • None does not check for vertical alignment

  • Top indicates that the needed should be top-aligned

  • Bottom indicates that the needle should be bottom-aligned

  • Center indicates that the needle should be center-aligned

Vertical alignment accuracy

String

 

The amount of allowed accuracy to still match the required alignment. For example, if 10% is used and the target is located at position 15 out of 320, then the validation succeeds.

Comment

String

 

Adds a comment to the script

On-fail Result*

Condition

Ignore | Break | Continue | Abort | Catch

The behavior when the command fails.

* Mandatory parameter