How do I resolve an error 'Unable to find an image match for the element selected during recording' ?
  • 03 Sep 2024
  • 3 Minutes to read
  • Contributors
  • Dark
    Light

How do I resolve an error 'Unable to find an image match for the element selected during recording' ?

  • Dark
    Light

Article summary

This feature will be rolled out gradually to customers. Please contact support if you’d like to use it.

What is this error?

In a Swipe to Element step, Autify locates the target element based on the appearance of area around the element that you selected during recording. If the appearance of the target element changes significantly or the detection pattern lacks distinctive features, Autify may fail to locate it, resulting in this error.

How to handle this error

To handle this error, it is necessary to distinguish whether Autify missed the element or it didn't swipe enough times.

In a Swipe to Element step, Autify swipes several times until the target element appears, taking a screenshot at each swipe. You can view these screenshots by using the arrows to the right of the test result screenshot.

en_swipe_to_element_test_result

Please check the screenshots to see if the target element was missed or not.

If the target element was missed

If the target element was missed, use Quick Element Update to update the element. Using Quick Element Update allows you to easily update the target element's information without re-recording.

To use Quick Element Update, open the Test Result page, click the Swipe to Element step, and then click the [Update element] button at the bottom right of the modal.

en_qeu_button_swipe_to_element

There are three ways to update elements using Quick Element Update:

In general, we recommend that you try image recognition first, followed by XPath, and then Accessibility ID. For details on each, see Quick Element Update.

If Autify didn't swipe enough times

If Autify didn't swipe enough times and the target element is not visible in any of the screenshots, you can increase the "Max swipes" (up to a maximum of 20) so that the target element appears in the screenshot.

en-max-swipes

Alternatively, you can re-record the step to make the swipe gesture is bigger, so that Autify reaches the element with fewer swipes. With Swipe to Element, the first swipe you make during recording will be repeated as many times as you set in Max swipes. By making this first swipe as large as possible, you can reduce the number of swipes needed to reach the element.

Image recognition

Use the arrows on the right side of the screenshot to navigate to the screenshot that contains the target element, and click the [Update element] button. Then, adjust the detection pattern and click [Update element].

en_qeu_swipe_to_element

When updating the element, the element and its surrounding areas should have a distinctive appearance. For more information, see Image recognition tips.

XPath

If Autify cannot reliably locate the correct element using image recognition, you can use an XPath to specify which element to target. After clicking [Update element], change Locator Type to [Page Source].

en_qeu_xpath_swipe_to_element

There are two ways to specify the XPath:

  • Use auto-generated XPath
  • Manually adjust the auto-generated XPath

Use the auto-generated XPath

Autify generates the XPath automatically. However, since it references the entire tree, changes that don't directly relate to the target element, or even minor changes such as reordering elements of the same type, can cause the element to not be found.

Manually adjust the auto-generated XPath

Auto-generated XPaths can be manually adjusted. You can improve reliability by adding information that'll help Autify locate the correct element, and deleting unnecessary information.

For more information, see XPath tips.

Accessibility ID

If the Swipe to Element step is still unreliable despite using image recognition and XPath, we recommend using Accessibility ID.

If there is no Accessibility ID

If the element doesn't have an Accessibility ID, you need to add it in your application code.

If the element has a "name" attribute on iOS or a "content-desc" attribute on Android, you can ensure that the target element is selected by setting these attributes in the Accessibility ID.

For more information, see Accessibility ID tips.

If you are still having trouble...

Please contact our Customer Support team. We will help resolve the issue.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.