Legacy | Image checkpoint

  • Command: checkpoint

  • Subcommand: image

  • 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

Verifies that the given image appears on the device screen. In case of failure, the script will be marked as failed.

By default, the find image function searches for the image on the current screen. If there is a possibility that the selected image is not in the current screen, you can 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 as the Search area.

For more information on how to use the Next parameter, see the Swipe Gesture in Analysis Functions article

This command should be used in combination with Visual Relations .

Parameters

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

The image to search for.

The image can be taken from the device screen using the preview tool or selected from the media repository.

If selected from the repository the image must be a JPEG, PNG or BMP file.

context

all (all)

body (body)

lowerPanel ()

upperPanel ()

all

Defines the screen region where to look for the needle.

match

identical (Same size)

similar (Any size)

bounded (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 other 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 respectively be increased.

Fine grained - split the screen and image to small pieces and compare each piece.

Bounded Size - same as Any Size with restrictions on possible needle sizes. This mode lets you decrease the any size analysis time by using apriori knowledge on needle sizes or by decreasing the size of a haystack.

source

primary (Primary)

camera (Camera)

secondary ()

 

The source for retrieving the screen content.

Primary - Digital screen image

Camera - Analog screen image

matchGeneric

   

A generic image compare parameter.

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

Examples:

matchMethod=TM_SQDIFF_NORMED

matchMethod=TM_CCORR_NORMED

report

screenshot (Screenshot)

screenshot-on-error (Screenshot on error)

none (None)

Screenshot

The value to display in the report.

Screenshot - display screenshot

Screenshot on error - display screenshots 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.

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

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

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

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

x.alignment

none (None)

left (Left)

center (Center)

right (Right)

None

None - Do not check for horizontal alignment

Left - Needle should be left aligned

Right - Needle should be right aligned

Center - Needle should be horizontally center aligned.

x.width

   

Value specify the amount of allowed accuracy to still match the required alignment. (e.g. if 10% is used and the target is located at position 15 out of 320 than the validation succeed)

y.alignment

none (None)

top (Top)

center (Center)

bottom (Bottom)

None

None - Do not check for vertical alignment

Top - Needle should be top aligned

Bottom - Needle should be bottom aligned

Center - Needle should be vertically center aligned

y.height

   

Value specify the amount of allowed accuracy to still match the required alignment (e.g. if 10% is used and the target is located at position 15 out of 320 than the validation succeed)

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.

measurement

rough (Rough)

accurate (Accurate)

Rough

The timer accuracy level.

Rough - Normal accuracy (seconds)

Accurate - Sub second (0.1 second)

To use this parameter, Screen source must be Camera

threshold

   

The acceptable match level percentage, between 20 and 100.

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

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.

image.top

   

The top value of the image area defining the needle.

Value is in pixels. Default is the entire image.

image.height

   

The height value of the image area defining the needle.

Value is in pixels. Default is the entire image.

image.left

   

The left value of the image area defining the needle.

Value is in pixels. Default is the entire image.

image.width

   

The width value of the image area defining the needle.

Value is in pixels. Default is the entire image.

condition

found (Found)

notfound (Not Found)

Found

Found - Success if the needle is found

Not found - Success if the needle is not found

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

imageBounds.needleBound

   

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.

imageBounds.haystackArea

 

786432

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 bounded size.

* Mandatory parameter

Request & Response

Copy

Request

https://mycloud.perfectomobile.com/services/executions/john@perfectomobile.com_controller_16-11-07_12_42_10_250?operation=command&user=john@perfectomobile.com&password=123456&command=checkpoint&subcommand=image&param.deviceId=T062800NO1&param.content=PRIVATE:temp%20media\wifi-icon.png
Copy

JSON response

{
  "reason": "Success",
  "timer.elapsed": "1997",
  "returnValue": "true",
  "testGridReportUrl": "https://mycloud.reporting-stg.perfectomobile.com?externalId[0]=john@perfectomobile.com_controller_16-11-07_12_42_10_250",
  "screenAnalysis.analyzedRegion.height": "1280",
  "description": "Success",
  "timer.system": "1997",
  "completed": "true",
  "screenAnalysis.analyzedRegion.left": "0",
  "flowEndCode": "SUCCEEDED",
  "screenAnalysis.analyzedRegion.top": "0",
  "screenAnalysis.resultRegion.left": "26",
  "screenAnalysis.resultRegion.height": "64",
  "screenAnalysis.resultRegion.top": "297",
  "executionId": "john@perfectomobile.com_controller_16-11-07_12_42_10_250",
  "timer.ux": "0",
  "singleTestReportUrl": "https://mycloud.perfectomobile.com/nexperience/singletest/report/?reportRepositoryKey=PRIVATE:controller/161107/controller_16-11-07_12_42_10_250.xml&ownerId=john@perfectomobile.com&sharingCode=1d7ef76b-420f-4eb1-beab-a1e70dee2601",
  "screenAnalysis.analyzedRegion.width": "720",
  "screenAnalysis.resultRegion.width": "58",
  "reportKey": "PRIVATE:controller/161107/controller_16-11-07_12_42_10_250.xml",
  "screenAnalysis.grade": "100",
  "timer.device": "0"}