Legacy | Select text

  • Command: text

  • Subcommand: select

  • Supported Platforms: Native (legacy), UFT (legacy), Selenium, Appium

    All commands must be executed using the same framework. Sharing the execution ID between different frameworks is not possible. This means that if you work with a Selenium/Appium driver, you need to call the commands using the Selenium/Appium driver (or, in the case of Reporting commands, through the Reporting SDK that works with the driver) and not as part of a UFT test or another framework.

  • Supported OS: Android, iOS

Description

Clicks on the text specified by the label parameter.

By default, the select text function searches for the text on the current screen. However, if there is a possibility that the selected text is not on the current screen, enable the Scroll and search parameter. When enabled, the default scroll direction is down. For iOS devices, the default scroll direction is right. To change the scroll direction to down, select body in the Search area parameter.

For more information on how to use the Next parameter, see Create custom swipe gestures

This command should be used in combination with Visual Relations.

Parameters

Name Value Default Description
deviceId*     The device for this command.
content*    

The text to search for.

It is recommended to use 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.

context

all (all)

body (body)

lowerPanel ()

upperPanel ()

all

Defines the screen region where to look for the needle.

source

primary (Primary)

native (Native)

camera (Camera)

auto (Auto)

secondary ()

 

The source for retrieving the screen content.

Primary - Screenshot taken from the device (higher resolution but slower)

Native - Native device controls

Camera - Screenshot taken from the video stream (lower resolution but faster)

Auto - Native device controls, if available. Else, digital screen image, if available. Else, analog screen image.

target

as-is (As is)

any (Any)

As is

The target search in case the needle includes more than one word.

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

Any - Search for any word in the string. When selecting Any, the words in the Expected text parameter can be divided into phrases with quotation marks.

Example - "new contact" "add contact"

timeout

 

0

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

For a dynamic screen, specify the expected waiting time for the needle to appear.

For example, the page loading time.

The timeout contains the system analysis time, for this reason it is recommended to specify at least 20 seconds.

The default, defined as 0, is a single attempt to find the needle.

threshold

   

The acceptable match level percentage, between 20 and 100.

Default is calculated by the system according to the needle.

Too low values can lead to a false positive result, while too high values can lead to a false negative result.

This parameter is not relevant when using native screen source.

profile

default (Default)

DocumentConversion_Accuracy (Document Conversion Accuracy)

DocumentConversion_Speed (Document Conversion Speed)

DocumentArchiving_Accuracy (Document Archiving Accuracy)

DocumentArchiving_Speed (Document Archiving Speed)

BookArchiving_Accuracy (Book Archiving Accuracy)

BookArchiving_Speed (Book Archiving Speed)

TextExtraction_Accuracy (Text Extraction Accuracy)

TextExtraction_Speed (Text Extraction Speed)

FieldLevelRecognition (Field Level Recognition)

BarcodeRecognition (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

   

A generic OCR parameter.

Use this to provide additional OCR specifications that are not exposed as function parameters.

Example - "isolate=true" It is possible to provide multiple specifications.

This parameter is not relevant when using native screen source.

analysis

full (Full)

automatic (Automatic)

manual (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.

inverse

any (Any)

yes (Yes)

no (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

This parameter is not relevant when using native screen source.

language

English (English)

Spanish (Spanish)

Japanese (Japanese)

German (German)

French (French)

Dutch (Dutch)

Italian (Italian)

ChinesePRC (Chinese)

Russian (Russian)

PortugueseStandard (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.

policy

auto (Auto)

accuracy (Accuracy)

performance (Performance)

Auto

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.

screen.top

   

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

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.

It is recommended to use the percentage value as it does not rely on the screen resolution.

screen.height

   

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

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.

It is recommended to use the percentage value as it does not rely on the screen resolution.

screen.left

   

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

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.

It is recommended to use the percentage value as it does not rely on the screen resolution.

screen.width

   

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

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.

It is recommended to use the percentage value as it does not rely on the screen resolution.

duration

 

0

The duration, in seconds, the found needle should remain on the haystack.

interval

 

0

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

   

The key sequence to perform the backlight operation.

Example - VOL_UP

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

scrolling

noscroll (False)

scroll (True)

False

Scroll until the needle is found.

Scroll cannot be used together with a positive Timeout, because they 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.

maxscroll

 

5

The maximum number of scroll actions to perform before returning.

Finding the needle will stop the scrolling.

Effective values are in the range of 0-100.

next

SWIPE_UP (SWIPE_UP)

SWIPE_DOWN (SWIPE_DOWN)

SWIPE_RIGHT (SWIPE_RIGHT)

SWIPE_LEFT (SWIPE_LEFT)

UP (UP)

DOWN (DOWN)

RIGHT (RIGHT)

LEFT (LEFT)

 

The key sequence to perform the scroll operation.

For more information, see the Create Custom Swipe Gestures post.

usecache

use (Use)

nouse (No Use)

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

contain (Contain)

equal (Equal)

startwith (Start with)

endwith (End with)

first (First)

last (Last)

index (Index)

 

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

index

   

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

words

substring (False)

words (True)

False

The search option to match only whole words in the haystack, or also part of other words

Example - Define whether 'person' in 'personal' is a good match or not.

True - match whole needle words in the haystack

False - match whole or sub-string words in the haystack

ignorecase

nocase (True)

case (False)

True

The search pattern case sensitivity.

True - insensitive

False - sensitive

ignorespace

nospace (True)

space (False)

True

The option to ignore spaces during search pattern words.

True - ignore

False - do not ignore

ignorepunct

nopunct (True)

punct (False)

True

The option to ignore punctuation characters when matching text.

True - ignore

False - do not ignore

exact

   

The option to find the exact needle phrase with no errors.

This parameter is not relevant when using native screen source.

shift

none (None)

above (Above)

below (Below)

left (Left)

right (Right)

leftmost (Leftmost)

rightmost (Rightmost)

 

The direction to move the touch location, relative to the center of the found needle.

To use, select the direction and the Position value distance.

By default the touch operation position is at the center of the matched needle.

For Leftmost and Rightmost, the value represents the distance from screen edge.

offset    

The distance from the center of the found needle to the location of the touch operation. Used alongside the Touch position parameter.

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

operation

single (Single tap)

double (Double tap)

long (Long tap)

roll (Trackball roll)

none (No touch)

 

The touch operation to perform on the found label location.

repeat

 

1

The number of times to repeat the operation. Relevant for tap and double tap actions only.

report

all (All)

all-on-error (All on error)

screenshot (Screenshot)

screenshot-on-error (Screenshot on error)

text (Text)

none (None)

Screenshot

The value to display in the report.

Screenshot - display 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 screenshot only for actions in error

None - display nothing

It is recommended to reduce the resolution in very long scripts that result in large report files.

report.resolution

high (High)

medium (Medium)

low (Low)

High

The image resolution.

It is recommended to reduce the resolution in very long scripts that result in large report files.

 

grid

   

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

Selecting this parameter creates the grid report.

relation.direction

left (Left)

right (Right)

above (Above)

below (Below)

left-above (Left-Above)

left-below (Left-Below)

right-above (Right-Above)

right-below (Right-Below)

inside (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

relation.inline

horizontal (Horizontal)

vertical (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

* Mandatory parameter

Request & Response

Copy

Request

https://mycloud.perfectomobile.com/services/executions/john@perfectomobile.com_controller_16-11-06_15_25_52_221?operation=command&securityToken=<your_token>&command=text&subcommand=select&param.deviceId=T062800NO1&param.content=Wi-Fi
Copy

JSON response

 {
  "reason": "Success",
  "timer.elapsed": "1997",
  "testGridReportUrl": "https://mycloud.reporting-stg.perfectomobile.com?externalId[0]=john@perfectomobile.com_controller_16-11-06_15_16_59_218",
  "screenAnalysis.analyzedRegion.height": "1280",
  "description": "Success",
  "timer.system": "1997",
  "completed": "true",
  "screenAnalysis.analyzedRegion.left": "0",
  "flowEndCode": "SUCCEEDED",
  "screenAnalysis.analyzedRegion.top": "0",
  "screenAnalysis.resultRegion.left": "145",
  "screenAnalysis.resultRegion.height": "26",
  "screenAnalysis.resultRegion.top": "316",
  "executionId": "john@perfectomobile.com_controller_16-11-06_15_16_59_218",
  "timer.ux": "0",
  "screenAnalysis.resultPoint.x": "183",
  "singleTestReportUrl": "https://mycloud.perfectomobile.com/nexperience/singletest/report/?reportRepositoryKey=PRIVATE:controller/161106/controller_16-11-06_15_16_59_218.xml&ownerId=john@perfectomobile.com&sharingCode=b9fc854a-464d-4bc2-a954-d5b364c53757",
  "screenAnalysis.resultPoint.y": "329",
  "screenAnalysis.analyzedRegion.width": "720",
  "screenAnalysis.resultRegion.width": "76",
  "reportKey": "PRIVATE:controller/161106/controller_16-11-06_15_16_59_218.xml",
  "screenAnalysis.grade": "100",
  "timer.device": "0"}