Select image (FR)

Perfecto Command

mobile:image:select

Purpose

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.

This command should be used in combination with Visual Relations.

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

Parameters

Name Type Possible Values Description
content (Mandatory) Multimedia  

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.

shift String none | above |
below | left | right |
leftmost | 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.
None
Above
Below
Left
Right
Leftmost
Rightmost
offset String  

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

Value is interpreted to be either

  • a number of pixels
  • or a percentage of screen width (0-100). For percentage use the % sign. Example - 20%
operation String single | double |
long | roll | none
The touch operation to perform on the found image location.

In addition, the General Visual Analysis common and image parameters are supported.

Return Value

None

Exceptions

None

Examples

Copy

Java sample

Map<String, Object> params = new HashMap<>();
params.put("content", "PRIVATE:Home-cropped.png");
params.put("threshold", 80);
params.put("imageBounds.needleBound", 30);
driver.executeScript("mobile:image:select", params);
Copy

C# sample

Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("content", "PRIVATE:Home-cropped.png");
pars.Add("threshold", 80);
pars.Add("imageBounds.needleBound", 30);
driver.ExecuteScript("mobile:image:select", pars);