For a web based application, you manage Element selector (or locator) from its corresponding View in the Context. Unless you are using Advanced elements with a custom defined CSS/Xpath or JQuery selector, Elements always maintain correlation with Views.
From time to time, as the test application UI is updated, you may need to reconcile the definition of existing elements in the Repository. Depending on the nature of the change, you may or may not need to capture a new View.
If the changes are primarily related to the layout of the page or additional fields getting added, you may not need a new View. As long as the element attributes you are utilizing in the Element locator are not impacted, there is no need for for capturing a new View.
However, if the application UI is significantly re-worked, you will be required to capture a new View to update element definitions. But the process of reconciliation is a simple 2-step activity.
Element Reconciliation: Updating Element Locators for Application UI changes
Step 1: Capture new View for the updated application screen in the same Context where the original View was captured. All the elements from the Repository (belonging to the View being replaced), which have not changed in the new version of your application are automatically mapped to this new View. When you hover on such elements, you will see a green background with the element name displayed.
Step 2: For the elements that are not mapped in the new View (because of a significant change in the new DOM), follow this process to reconcile.
- Right click on the element in new View.
- Click on "REPLACE SAVED ELEMENT" option.
- List of all elements from the Repository are presented. Elements that may be most likely replaceable by the hovered element are put on the top in bold font.
- Select one of these elements. This element in the Repository is updated based on the hovered element in the View.
- Element Properties window is displayed. Confirm or fine tune the locator and click on Save button.
Existing element is now updated with new attributes and we are done! There is absolutely no need to change Action logic or other entities in the Project.
You can repeat this process for all elements not discovered in the new View.
Note: Once you begin the update process on one of the elements, View Context menu will default to "Replace a Saved Element" option until you change again to Command option. This allows quick reconciliation on a series of elements in one stretch.
Automatic Logic Updates during Element Reconciliation
When you update an element for application changes, it may sometimes be possible that the Element Type may have changed as well.
For example, in the screenshot below, Transfer from and Transfer To fields were dropdown controls in the V1 of the application-under-test. These fields are now changed to Input fields in the V2 of your software.
When you follow the steps for Element Reconciliation as listed above, any existing Action logic that is dealing with dropdown elements automatically updates to Input field based logic. For example, if you had logic to select-items-from-dropdown, it is auto-updated to enter-text-in-field type of logic.
Note: If there is inconsistency in the element mapping, system throws an error and aborts Reconciliation process. For example, if you are trying to map an existing dropdown element to a button in the new View, this operation is blocked with appropriate error message.