-
Print
-
DarkLight
What should I do if an element is not found or if an incorrect element is selected?
Sometimes, Autify may click on an element different from the one you recorded or be unable to find the correct element, causing the test to fail.
This page describes what to do when Autify cannot find the target element or selects the wrong element.
1. If the element is not found
If the element is not found, the following error message appears:
1-1. Check whether the target element was present when the scenario was executed
If the error message "Element not found" appears, there are two possible causes:
- The target element doesn't exist on the page.
- The target element exists on the page, but Autify cannot find it.
The solution depends on the cause. If you see the message "element not found," please confirm that the target element exists on the page by looking at full screenshots for failed steps or individual test results.
If the target element doesn't exist on the page, please see section 1-2.
If you believe that the element exists on the page but Autify could not find it, please see section 1-3.
1-2. What to do if the target element does not exist on the page
In this case, you will need to investigate why the target element was not present when the scenario was executed.
Please see whether any of the following possible reasons applies:
An earlier step failed
Autify may fail to validate the appropriate page if something goes wrong in an earlier step (for example, an incorrect element was clicked or data was not input to the correct element). If this is the case, please fix the earlier step that is causing the issue.
Please note that you can check what actions are performed on each step by looking at screenshots and the Video Log.
Also, if the step that's causing the issue is performing an action on the wrong element, please see section 2.
The time zone had an effect
[Generally, the time zone of Autify's test environments is UTC]. (https://help.autify.com/docs/can-i-specify-the-time-zone-of)
The time zone may affect the display of test data, causing the target element to not appear.
The page was still loading
If Autify searches for the element while the page is still loading, please try adding a Sleep Step just before the step that failed.
Please see this article on how to add a Sleep Step.
※Autify is designed to continue searching for an element for a certain period of time even if the target element doesn't exist on the page. Therefore, as long as it's within that timeframe, you can verify without adding a Sleep Step.
For more information, please see Validation of SPA and other pages with asynchronous communication.
Other tests had an effect
On Autify, whether the test is executed in parallel or sequentially depends on whether parallel execution is enabled in Workspace settings, how the test is executed, and whether the test uses the Data feature.
Please be aware that a test may be affected if other tests are performed on the same application.
1-3. What to do if the target element exists on the page but Autify cannot not find it
Autify searches for the target element based on the information at the time of recording and the results of previously successful test executions.
Therefore, in the following cases, Autify may be unable to find the element even if it exists on the page.
If any of the following apply, please try the solution described.
The element could not be found because the page had been changed
Even if the characteristics of an element are no longer an exact match with those from previous test runs due to page revisions, Autify will track the closest matching element.
However, Autify may be unable to track the correct element depending on how the element changes.
Please check the Difference in Test Results. If there is a difference, this may be the cause.
In this case, please update the element information using one of the following methods:
- Re-record the target step by clicking Record Here.
- Update the element by using the Quick Element Update feature.
The element could not be found because there was not enough information to identify the element
If the target element cannot be found even though the page has barely changed, there may not be enough information to identify the element, or there are similar elements.
In this case, using a locator will help.
Please try specifing a locator. For more information, see Add a locator to specify an element.
2. The wrong element is identified as the target element
Unlike the first case, this failure will not display an error message.
However, this may be causing the issue if the [Review Needed] message appears or if an earlier step failed (for example, Autify clicked the wrong element and couldn't transition to the desired page, causing in the assertion step to fail).
In the following cases, Autify may validate the wrong element even if the correct element exists on the page.
Please try the solution described if any of the following apply.
Autify selects the wrong element because of page changes
Even if the characteristics of an element change due to page revisions and it is no longer an exact match, Autify will track the best matching element.
However, depending on the nature of the change, the wrong element may be selected.
Please check the Difference in Test Results. If there is a difference, this may be the cause of the issue.
In this case, please try one of the following methods to update the element's information:
- Re-record the relevant step by clicking Record Here.
- Update the element by using the Quick Element Update feature.
The correct element cannot be recognized because there are similar elements
Autify searches for elements based on the information obtained during recording and successful test runs. However, if there are elements with similar information, it may recognize the wrong element as the target element.
In this case, please specify the element using a locator.
For more information on how to do this, please see Add a locator to specify an element.
Autify learned the wrong element as the target element
If you run a scenario under conditions where the target element is not displayed, Autify may learn the wrong element, resulting in the wrong element being identified as the target in subsequent test executions.
In this case, please try updating the element information in one of the following ways:
- Re-record the relevant step by clicking Record here.
- Update the element by using the Quick Element Update feature.
- Specify a locator. For more information, see Add a locator to specify an element.
Related articles
You can find further information on how to specify CSS Selectors and answers to frequently asked questions in the following articles:
- How to use CSS selectors
- Target element not found
- If there is a problem with the CSS selector, how do I fix it?
- What do I do if the target element is not rendered or set to invisible?
- How can I make my test stable if the element contains dynamic data?
If none of the above solutions work, please contact support.