Best Practices on the optimization of an element
A SAP Intelligent RPA project is based essentially in two phases :
- Capture + declaration of applications / pages / elements
- Design of the workflow with activities
In this blog post I am going to talk about the declaration phase and more precisely about how to optimize the recognition of your application.
This blog post will be cut in different parts :
- Recognition tab
- Number of tests
- Number of elements in a page
The automation of any kind of application (web, UIAutomation, etc.) can only be done properly with a good recognition of both pages / elements.
Note : The recognition of your application / element is as important as the development of your workflow. If it’s not done properly the automation won’t work 100% of the time.
This includes multiple things like :
- Using the most unique criteria for each page / element
- Be sure that this element is seen as unique by the connector (using the debugger for example)
Sometimes this is not enough, some side effects can be seen during the automation.
For example, if the following error message appears “Timeout waiting response from pilote” it means that we must optimize the recognition of the target element. Technically speaking, the connector send the action to the element but it takes too much time to give a response back.
Do we have a tool to see if an element is well optimized or not ?
In SAP Intelligent RPA 1.0 we have the possibility to see how many tests are done by the connector to recognize a particular page / element
These tests can help us knowing if an optimization needs to be done or not.
In the Desktop Studio, on applications recognition side look at the right side after the parameters you should see the “Recognition” button.
By clicking on each page of an application you will see how many tests are done to recognize each element.
As you can see below, some of the elements have more than 4000 tests before being recognized.
Number of tests
What we want to do is to have less tests as possible and reach 1 test if possible.
To do so, we will have to optimize the recognition with advanced recognition capability.
Note : Depending on the connector, it’s not always necessary to optimize when you see a big number of tests
- Web : This connector is fast and having 500 – 1000~ is not a big number of tests, the automation can work fast and properly.
- SAPGUI : When using an ID / name as a criterion for an element (having like 3000 tests is not an issue in this case as the connector already benefit of an internal optimization)
There is not a “good” range of the number of tests, it depends on the technology. As I said for web it can be 1000 and still working fine but for UIAutomation it would be too much.
For any other situation, the usage of advanced recognition has to be implemented.
It’s not mandatory at all but if you see a slow automation for example and you want to boost it, optimize the recognition is probably the best way to achieve it.
Warning : There is a compromise between having less tests and the number of criteria used to recognize an element.
For example, you will have a low number of tests by using the items pattern method, however by doing this if the application’s DOM change then you will have to update the criteria again.
It has to be known by the developer before doing any development
Number of elements in a page
The optimization is also related to the number of elements recognize in your page.
There is not a maximum of element per page, but the good practice would be to have only useful elements :
- Interaction with inputs during the automation
- Elements used for the advanced recognition (Ancestor, Must exist / Must not exist, etc..)
Keep it as small as possible as the connector will test, in order, each element.
If the connector test pointless element before the element you want to interact with you will lose some precious time.
As we saw together, when we talk about recognition optimization we need to take a look at the recognition panel.
There is not a “good” amount of tests, each connector is not working the same regarding the recognition.
- If an element needs to be optimized follow the advanced recognition methods.
- As a best practice keep only the useful elements. Keeping an element which is not used during the automation or not used to recognize another element will slow the entire recognition of your page.
Now you know more about the optimization and the way to verify if an application is well recognized.
You will find more information about the recognition panel by following this link to the official documentation