When you record a step in a browser test that interacts with an element on the page, mabl tracks over thirty distinct attributes, including text, CSS classes, data-test-id, and other information such as location and size on the page. This information is known as the element history and helps identify the correct element in subsequent test runs.
If an element's attributes get updated, either because of a small update in the application or a successful auto-heal, mabl records this information in the step's element history.
Element history is tracked separately per environment. For example, if a test runs in two environments, a step tracks element history for both environments separately.
This guide outlines how to review a test step's element history.
Viewing element history
To view the element history for a step, go to the test output page for the test run and follow these steps:
- Click on the test step.
- Select the Logs tab.
- Click on the Element history button in the mabl Activity tab. The element history appears in a modal.
Viewing element history on the test output page
The top row has a "current" label and indicates the latest information that mabl uses to identify the target element. Attributes that changed are highlighted. Previous versions of the element, from both auto-heals and small updates, appear in the rows below.
If a strong match for an element was found, but a few attributes changed, mabl makes a small update to the element history as long as (1) the test run ultimately passes and (2) the test run is part of a plan run.
If mabl did not find a strong match and attempted an auto-heal, the auto-heal is recorded in the element history as long as (1) the test run ultimately passes and (2) the test run is part of a plan run.
You can roll back to a previous version in the element history by clicking on the clock icon.
When you roll back the element history, any more recent versions of the element (rows above the selected version) are deleted. Since element history is tracked separately per environment, rolling back the element history in one environment does not affect the element history in other environments.
Rolling back the element history
Rolling back the element history does not prevent the same auto-heal from happening. For more information on preventing auto-heals, see the auto-heal FAQs guide.
Shared element history
In the following cases, an element and its history are shared among multiple steps:
- The same element is used across steps during training.
- For example, if the test records a click step on an input field and then a step that enters text into the input field, mabl tracks a shared element history for both steps.
- The step is part of a flow, and the flow is used in multiple tests.
- The step, or the entire test, was duplicated.
- If you duplicate a step, both steps share the same element history.
- If you duplicate a test, the steps that were duplicated share an element history with their original counterparts.