Find image (FR)
Perfecto Command
mobile:image:find
Purpose
Finds an image (needle) on the device screen (haystack) and stores the coordinates for future commands. By default, the find image function searches for the image on the current screen.
This command is used as the first step in a Visual Relationship sequence:
- Perform Find image to identify the location of the image on the screen.
- Perform a text or image visual analysis command using the visual relation parameters to identify the element relative to the image identified with the Find image execution.
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. |
context | String | all | body | Defines the screen region where to look for the needle. |
measurement | String | rough | accurate | The timer accuracy level. Rough (default) - Normal accuracy (seconds) Accurate - Sub second (0.1 second) To use this parameter, Screen source must be Camera |
In addition, the General Visual Analysis common and image parameters are supported.
Return Value
String indicating success ("true") or failure ("false")
Exceptions
None
Examples
Java sample
Map<String, Object> params = new HashMap<>();
params.put("content", "PRIVATE:/images/flight.png");
params.put("context", "body");
String res = (String)driver.executeScript("mobile:image:find",params);
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("content", "PRIVATE:/images/flight.png");
pars.Add("context", "body");
String result = (String)driver.ExecuteScript("mobile:image:find",pars);