Editing Target Element Properties (Mobile)

The target element is the element that was selected in the AUT (application under test) as the main element for the step. The target element is editable. The element itself appears as a thumbnail image in the Properties panel.
The following options are shown when hovering over the thumbnail: Highlight, Reassign, and View locators.

  • Highlight – Clicking on Highlight opens the AUT with the target element momentarily highlighted in pink. This can be helpful because it allows you to visually confirm in the AUT what the target element is.
  • Reassign – This option allows you to replace your target element with a different target element from your AUT. In this case, the system removes and overrides all the locators for the target element of a step. This option is relevant when you want to select a completely different element as the target. For example, your target element was a blue button that says "login", but now this button doesn’t exist anymore. In this case you will need to use the Reassign feature to select a new target element. See Reassigning the target element.
  • View locators – When an element is selected during a recording (click, hover, enter, etc.), Testim's algorithm analyzes a wide variety of attributes associated with the element. These attributes are known as Locators. When the test is run, the system uses the locators to locate the target element. To do so, the system uses two methods to determine a confidence level that the target element is indeed the same as the original one, although some of its attributes may have changed. This way, if the element was changed but is still functioning, Testim's Locators will find it and keep the test from failing. To learn more about viewing Locators, see Viewing Locators.

Highlight Target Element

Before making changes to a target element, you can highlight the element in the AUT browser to visually confirm which element is the current target element.

To highlight the target element:

  1. Hover over the step for which you want to highlight the target element and click the Show Properties button.

The Properties panel opens on the right-hand side.

  1. Hover over the target element thumbnail and click the Highlight link.

The highlight is displayed for a few seconds only.

Reassigning the Target Element

This option allows you to replace your target element with a different target element from your AUT. In this case, the system removes and overrides all the locators for the target element of a step. This option is relevant when you want to select a completely different element as the target. For example, your target element was a blue button that says "login", but now this button doesn’t exist anymore. In this case you will need to use the Reassign feature to select a new target element.

To reassign the target element in a “click” step:

  1. Hover over the step you want to reassign and click the Show Properties button.

The Properties panel opens on the right-hand side.

326
  1. Hover over the Target element thumbnail and click the Reassign link.
322
  1. Click the desired element. Try to choose text elements and avoid outer frames, images and icons for better stability.

The preview of the reassigned target element will appear in the Properties pane.

Viewing Locators

The Locators are how Testim uniquely identifies each element on the screen and determines if the element still exists or not. Testim inspects the entire DOM, considering a wide variety of attributes that are related to the target element (e.g. text, id, class, etc.). These attributes are called locators. Some of these locators are part of the DOM (i.e., include aspects of the target element itself as well as parent elements), while others, such as inderOnlyXpath are pre-calculated attributes.

There are two modes to locate the target element:

  • Fallback locators mode: in this mode the system analyzes each locator that is related to the target element in a sequential manner, while specifying a score for the locator based on its uniqueness on the screen. One of the advantages of this mode is that it is possible to edit the values of the locators, including the ability to use parameters as part of the value. For example, you can edit the text locator of a button target element, by specifying that its value is a different text.

    🚧

    Editing the locators is a sensitive process that requires advanced knowledge of the DOM structure. Before editing consider reassigning the target element. If you are unsure of the consequences, please consult support. In any case using the ML mode (see below) does not require fine-tuning of the locators at all.

  • Machine learning mode: this is the default mode, as it is more advanced. This mode uses a machine learning model that has been trained with tens of thousands of examples. When the test is executed the system queries the machine learning model, which generates a confidence score. If the confidence score is above a certain threshold the system will determine that the target element is the same, even when certain attributes have been since modified. It is possible to modify the threshold level and set it to high (i.e., only when the confidence score is really high, it can be determined that this is the target element), medium, or low. Each level has its own pros and cons, for example, the low level can potentially determine that it is the target element, when it is not. Similarly, the high level can determine that the element is not the target element, but in reality it is.

You can view the attributes used to locate the target element on the Locators panel. You can also visually identify the target element and its parent elements.

Fallback locators mode

Enabling the Fallback locators mode

To enable fallback locators mode:

  1. On the Properties panel of a step, hover your mouse on the Target Element section.
  2. Click the View Locators link.
  3. Click the drop-down menu next to Machine Learning Mode.
  4. Select the Fallback locators mode option.

The following notice is displayed:

  1. Click Switch.

Viewing locators in Fallback locators mode

After running the test, the locators panel in Fallback locators mode displays a list of locators that were used in order to locate the target element on the screen. The list includes locators that are based on the DOM (top of the list) and locators that are calculated by the system to provide more context.

Identified By

In Fallback locators mode, the system tries to locate the target element on the screen in a sequential manner by running though the various locators that are listed on the pane. In some cases, one locator will be enough to identify the element on the screen and in other cases the system will aggregate multiple locators to reach the conclusion with a certainty level that is above the threshold. The locators that were used to find the element are labeled with "IDENTIFIED BY".

Enabling/Disabling locators in Fallback locators mode

📘

You can select/de-select different locators or edit the content. Keep in mind, that Testim's algorithm has determined these ratings automatically. Sometimes, an application will behave in an unexpected way, and manually selecting specific attributes to identify the element can be advantageous to improving stability. However, we recommend consulting with Testim Support before making such changes.

In some cases a locator may produce a false positive or false negative result. If you want the system to disregard it, you can simply select or deselect its related checkbox. After doing so, click Save and run the test again.

Editing locators in Fallback locators mode

🚧

Editing the locators is a sensitive process that requires advanced knowledge of the DOM structure. Before editing consider reassigning the target element. If you are unsure of the consequences, please consult support. In any case using the ML mode (see below) does not require fine-tuning of the locators at all.

It is possible to edit the locators. The editing of the locators includes defining the conditions to match the target element. For example, in a text locator you can enter a different text string than the one captured in the the recording. If system finds this text in an element during the text execution, it will be considered as match, i.e., that the target element was found. The value can include specific matching conditions, for example, equals, contains, starts with, etc. It is also possible to define the value as a parameter or part of the value as a parameter. For more information on how to use parameters, see Parameters. The value can be optionally evaluated as an expression. In this mode you can add additional conditions within the value itself.

To edit the locator:

  1. In the View Locators panel, click Edit on the desired Locator.

The Edit Selector dialog is displayed.

  1. In the Match If field, select one of the following conditions:
    1. Equals - the locator will be considered as matching only if the target element is exactly as the value/expression result in the Value field below.
    2. Contains - the locator will be considered as matching only if the target element at least contains the value/expression result in the Value field below.
    3. StartsWith - the locator will be considered as matching only if the target element starts with the value/expression result in the Value field below.
    4. EndsWith - the locator will be considered as matching only if the target element ends with the value/expression result in the Value field below
  2. In the Value field, do one of the following:
    1. To use a regular value, enter the value that needs to be matched with the target element. The regular value can be or include a parameter. For more information on how to use parameters, see Parameters.
    2. To use an expression, enter the expression that needs to be matched with the target element and select the Evaluate as an expression checkbox. So for example, assume we have a variable called “number” with a value of 5: if “evaluate as expression” is selected and the value is “number” for the ‘text’ field, the system will try to locate the text ‘5’. If it’s not selected, the system will try to locate the text ‘number’
  3. Click OK.

Machine learning mode

Enabling the Machine learning mode:

The machine learning mode is the default mode, but if you are currently in Fallback locators mode, follow these steps to enable the Machine learning mode.

To enable machine learning mode:

  1. On the Properties panel of a step, hover your mouse on the Target Element section.
  2. Click the View Locators link.
  3. Click the drop-down menu next to Fallback locators mode.
  4. Select the Machine learning mode option.

Viewing the locators in the Machine learning mode

In Machine learning mode, the system uses machine learning models, which have been trained with tens of thousands of examples, to determine if the target element is the same, despite various changes to it, or it no longer exists on the screen, which means that the step should fail. This mode does not require any user intervention, no editing of the target element, etc., making it easy to use and adding unprecedented stability to the tests.

After running the test, the locators panel in Machine learning mode displays a list of locators that were used in order to locate the target element on the screen. The list includes locators that are based on the DOM (top of the list) and locators that are calculated by the system to provide more context.

Setting the Threshold level in Machine learning mode

Testim offers the ability to manually fine tune the algorithm’s threshold to your preferences through the UI as follows:

  • High threshold - only when the confidence score is really high, it will determine that it found the target element.
  • Medium threshold – when the confidence score is medium, it will determine that it found the target element
  • Low threshold - even if the confidence score is low, it will determine that it found the target element.

To set the threshold level:

  1. In the View Locators panel, under the Threshold level, click the drop-down menu.
  2. Select the relevant level.
  1. Click Save.
  2. Rerun the test.