Button.Click(image) command
Identifies a button based on an image label and clicks it. The image file should be stored in the repository prior to running this command.
By default, the find image function searches for the image on the current screen. However, if there is a possibility that the image is not on the current screen, enable the Scroll and search parameter. When this parameter 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 | Type | Possible values | Description |
---|---|---|---|
Device ID* |
Device |
|
The device for this command. By default, this is the device under test (DUT). |
Label* |
Media |
The image that appears on, or related to, the button. 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. |
|
Timeout |
Number |
|
The time, in seconds, to wait for the label to appear. For a dynamic screen, specify the expected wait time for the label to appear (for example the page load time). The timeout contains the system analysis time. For this reason, it is recommended to specify at least 20 seconds. |
Threshold |
Number |
20-100 |
The acceptable match level percentage, between 20 and 100. Values that are too low can lead to a false positive result, while values that are too high can lead to a false negative result. |
Scroll and search |
String |
False | True |
Scroll until the label is found. This parameter cannot be used together with a positive timeout value because both 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 |
0-100 |
The maximum number of scroll actions to perform before returning. Finding the label will stop the scrolling. |
Label position |
String |
Inside | Above | Below | Left | Right | Leftmost | Rightmost |
The label position relative to the button. Used alongside the offset parameter. Rightmost and Leftmost Label position values represent the distance from screen edge.
|
Label offset |
String |
Used alongside the The value can be in pixels or in percentage of screen height (0-100). For percentage, use the % sign. For example: 20% |
|
Label top |
String |
The top value of the image area defining the label. The value is in pixels. Default is the entire image. |
|
Label height |
String |
The height value of the image area defining the label. The value is in pixels. Default is the entire image. |
|
Label left |
String |
The left value of the image area defining the label. The value is in pixels. Default is the entire image. |
|
Label width |
String |
The width value of the image area defining the label. The value is in pixels. Default is the entire image. |
|
Haystack top |
String |
The top value of the screen area to be searched for the label. The value can be in pixels or in percentage of screen height (0-100). For percentage, use the % sign. Example: 20% Default is to search the entire screen. It is recommended to use the percentage value because it does not rely on the screen resolution. |
|
Haystack height |
String |
The height value of the screen area to be searched for the label. The value can be in pixels or in percentage of screen height (0-100). For percentage, use the % sign. Example: 20% Default is to search the entire screen. It is recommended to use the percentage value because it does not rely on the screen resolution. |
|
Haystack left |
String |
The left value of the screen area to be searched for the label. The 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 because it does not rely on the screen resolution. |
|
Haystack width |
String |
The width value of the screen area to be searched for the label. The 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 because it does not rely on the screen resolution. |
|
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 (the needle is from another device or another source) or not of the same size (different ratio or size). Matching is slower and more complex. Selecting this value increases the analysis time. Make sure to increase the timeout values accordingly. Bounded Size: Same as Any Size, but with restrictions on possible needle sizes. This mode decreases the analysis time required for Any Size by using apriori knowledge on needle sizes or by decreasing the size of a haystack. |
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. |
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. 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 |
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. |
Screen source |
String |
Primary | Camera |
The source for retrieving the screen content. Primary: Digital screen image Camera: Analog screen image |
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. Default: 0 |
Backlight |
String |
The key sequence to perform the backlight operation. For example: VOL_UP For best practice, use a key that will not change the screen. |
|
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. |
Report |
String |
Screenshot | Screenshot on error | None |
The value to display in the report. Screenshot: (Default) Displays screenshots Screenshot on error: Displays screenshots only for actions in error None: Displays 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. Default: High 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. |
|
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 the 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 |
|
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. |
|
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