Select image command

Clicks on the image (needle) in the PNG file whose name is indicated by the content parameter. Store the image in the repository prior to running this command.

By default, the select image function searches for the text on the current screen. 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.

Parameters

Name Type Possible values Description

Device ID*

Device

 

The device for this command.

Expected image (needle)*

Media

 

The image to search for. If you select an image from the Perfecto repository, the image must be a JPEG, PNG, or BMP file.

You can select a file that already resides in the Perfecto repository or select a file from your computer that is then uploaded to the Perfecto repository. To learn more about the Perfecto repository, see Manage the repository. Click the Select media link, browse to the file, and then click SELECT.

Search area (haystack)

String

all | body

Defines the screen region where to look for the needle.

Screen source

String

Primary | Camera

The source for retrieving the screen content, which can be a digital screen image (primary) or an analog screen image (camera).

Timeout

Number

 

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

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

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

Haystack top

String

 

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

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 reducing the resolution in very long scripts that result in large report files.

Haystack height

String

 

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

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 reducing the resolution in very long scripts that result in large report files.

Haystack left

String

 

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

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 reducing the resolution in very long scripts that result in large report files.

Haystack width

String

 

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

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 reducing the resolution in very long scripts that result in large report files.

Needle top

String

 

The top value of the image area defining the needle. The value is in pixels. Default is the entire image.

Needle height

String

 

The height value of the image area defining the needle. The value is in pixels. Default is the entire image.

Needle left

String

 

The left value of the image area defining the needle. The value is in pixels. Default is the entire image.

Needle width

String

 

The width value of the image area defining the needle. The value is in pixels. Default is the entire image.

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.

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.

Touch position direction

String

None | Above | Below | Left | Right | Leftmost | Rightmost

The label position relative to the button (used alongside the Touch position value parameter), where: 

  • None indicates that the label is part of the button

  • Above indicates that the label is above the button

  • Below indicates that the label is below the button

  • Left indicates that the label is to the left of the button

  • Right indicates that the label is to the right of the button

  • Leftmost indicates that the button is aligned to the right, and its label is to the left

  • Rightmost indicates that the button is aligned to the left, and its label is to the right

Rightmost and Leftmost label position values represent the distance from the screen edge.

Touch position value

String

X and Y values separated by comma

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

Example: 20%

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

Operation

String

Single tap | Double tap | Long tap | Trackball roll | No touch

The touch operation to perform on the found label location.

Repeat

Number


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

Match mode

String

Same size | Any size | Bounded size

The needle comparison method.

  • Same Size: Needle and haystack are from the same origin (device screen) and size. Matching is faster and simpler.

  • Any Size: Needle and haystack are either not from the same origin (needle is from another device or another source) or not in the same size (different ratio or size). Matching is slower and more complex.

    Selecting Any Size increases the analysis time. The timeout values should be increased accordingly.

  • Bounded Size: Same as Any Size with restrictions on possible needle sizes. This mode can decrease the Any Size analysis time by using apriori knowledge on needle sizes or by decreasing the size of a haystack.

Report

String

Screenshot | Screenshot on error | None

The value to display in the report.

  • Screenshot: Displays screenshots.

  • Screenshot on error: Display 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.

  • 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.

For more information, see Visual Relations.

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

Needle bound

Number

 

The ratio in percentage by which the original needle width may vary. The ratio is defined as a (100 - specified percentage) / 100.

Needle sizes to be checked by the analysis will be limited to the range from original needle width multiplied by the ratio to the original needle width divided by the ratio.

To use this parameter, Match mode must be bounded size.

Haystack area

Number

 

The size of haystack to be used for the analysis. The haystack image will be scaled before being analyzed so its area does not exceed the specified value. Haystack images that do not exceed the value will stay unchanged.

To use this parameter, Match mode must be set to Bounded size.

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