SAP Netweaver - Dynamic ID's
This article provides you with the best practice how to steer dynamic ID's in SAP Web Interface, such as SAP Netweaver, SAP Business Client and SAP FIORI.
It is known, that the object IDs in SAP Netweaver (SAP Webinterface, SAP WebGUI) are generated dynamically everytime an object/element is displayed. This could be a headache for test automation tools and stability of the test cases.
With Tosca we are not only able to identify controls based on technical ids, but we can also use other techniques.
Solution 1: Object identification by more than one properties (Identify by Properties)
- Scan the required test object by using Tosca XScan.
- Deselect the dynamic ID (red box)
- Choose another control type (one or more), which is more suitable for stable identification of this object type.
For example, Tag and Title are good options (green box). "Sales Organization" will be uniquely identified and is stable for test case creation and execution.
Solution 2: Object identification by anchor (Identify by Anchor)
Scan the required test object by using Tosca XScan.
Open the Identify by Anchor window by clicking on the corresponding button in the HOME menu.
Select the control which should be identified.
Use drag and drop to move the control, whose identification criteria should be copied, to the Anchor Control field. The control is shown in this field as soon as you release the mouse button.
The Anchor Control Properties field shows the properties that were transferred along with the control.
Solution 3: Object identification by index (Identify by Index)
This option shows or hides the Identify by Index window. If a selected control does not have a unique ID, you can select an index to be used upon test execution to identify the control. Enable the checkbox next to Index to select the index. The index is calculated dynamically and on the basis of already selected identification criteria.
Solution 4: Parent Control object identification
If the control is unique only in a specific area (e.g. within one container), then this container could be used as a parent control for unique control identification. In this case the entire path/tree should be chosen too for the identification.
Picture 01: control is not unique
Picture 02: control is unique in a specific area (table container)
Solution 5: Identify by Image
Tosca is able to identify controls from an image by creating a screenshot for a specific control. For further information, please see also the Tosca Manual.
With that approach we were able to successfully finish all our customer projects.