How graphic area recognition works
Graphic area recognition is used in Agilitest to allow:
- to perform click-type actions, text entry, etc. on recognized areas.
- to execute graphic recognition checks of elements
Here's how it works:
At any time when you are in "capture" mode, you can identify a rectangular area of the application tested by drag-drop.
The selection of a locator
Agilitest then displays the image you have selected and allows you to copy it, save it, or go directly to generate a locator using it, by activating the display of the element tree.
When you click on "Element Tree", Agilitest will display the structure of the software or DOM to the smallest element that completely contains the selected image. This operation will allow you to ensure a unique identification of your image that could be printed in several places of your software.
Indeed, without selecting a locator, you can end up with an image present in several places, just use the magnifying glass tool to realize it:
To fix this issue, simply select the parent elements and their attributes to generate an additional locator and drop the whole into a new action of the Agilitest editor.
If during this selection phase of the locator you click on the "Statistics" button, Agilitest will temporarily hide the capture grid so that you can recognize the graphic component in the page.
Just after the drop in the editor, the generation of a new action is performed and displayed. It contains a link to an image that is saved in the src/assets/resources/images directory.
You can view all the images that have been used in your project by selecting the "Show resources images" menu of the project explorer:
The image search menu that you get by clicking on the image in the editor allows you to add the following information:
- Using a non-unique locator to identify occurrences, then select through an index the image uniquely.
- You can affect the graphical recognition tolerance and the algorithm used. For the moment only the ATS algorithm is proposed and we advise you to keep the default tolerance (0.5%).
Occurrence assertions will allow you to add controls on the presence of graphical elements in your applications, to count them, to generate wait-for timers, and so on.
To achieve them simply drop the graphic element in an action of type "Check of occurrence".
However, we must pay particular attention to this control of occurrences: Agilitest will check the images that are actually displayed on the page (unlike a DOM approach that can potentially trace objects not displayed).
In this case, it must be ensured that the window is correctly sized and displayed to allow complete recognition of the elements.