Fix ‘element not found’ error
The “element not found” error (i.e. ENF) is one of the most frequent errors that can cause a test to fail. Unfortunately, it’s often not easy to find out what caused the error, especially if you’re not that experienced in Ranorex Studio yet.
This is where this guide comes in. It will help you identify the most common causes of the error and resolve them so your test will execute successfully.
In this chapter
When you encounter the ENF error, report analysis is the first thing to do.
ENF error in Ranorex report
See the report identifying a test failure
ENF error stating that a UI-element could not be found
ENF errors are often rooted in the individual characteristics of an application under test. This means that this guide can only speak in very general terms about solving such errors.
The report provides several screenshots to make it easier for you to identify what went wrong. These screenshots show what happened in the last seconds up to the error.
Compare the screenshots and pay special attention to the UI element you wanted to find. Select corresponding to your analysis:
- Proceed to Step 1 if the UI-element is NOT in the screenshot
- Proceed to Step 2 if the UI-element is IN the screenshot
Step 1 – UI-element is not in screenshot
Make sure the application under test is in a correct state.
If the UI-element isn’t there, it means that your application under test (AUT) wasn’t in the correct state for the UI-element to be found within the search timeout. This can have various causes. For example, a button might not appear until a certain action is completed and this action is taking longer because the system is working slower than usual. This will cause the UI-element to be there during some runs, and not during others.
Ensure the application under test always reaches the correct state for Ranorex Studio to find the UI-element:
- Check that all the actions needed to reach this state are there. For example, if a UI-element is only reachable through a context menu, make sure there is an action that opens this context menu beforehand.
- Add validations to verify that the window, page, etc. that contains the UI-element appears during test execution.
- Increase the search timeout on the repository item or add a WaitFor action in the action table to compensate for slowdowns of the application under test and other possible delays.
If the UI-element is still not found, proceed to Step 2.
Step 2 – UI-element is in screenshot
Check the RanoreXPath specification of the UI-element.
If the UI-element is in the screenshot, it means that your application under test reached the correct state for the UI-element to be found within the timeout. However, Ranorex Studio still couldn’t find the UI-element, so something else must be wrong. The most likely explanation is a faulty RanoreXPath. This can have various reasons, such as changes to the GUI, dynamic parts, multilingual GUIs, or even simple typos.
Open the UI-element in Spy
To be able to check and edit the validity of the RanoreXPath specification it is necessary to open the UI-element in Spy.
Opening UI-element in Spy
Ensure the application under test is in the same state when the ENF error occurred
Select the repository item and click EDIT IN SPY to open it in Ranorex Spy
Identify faulty RanoreXPath elements
First of all, the highest faulty level in the UI-element tree browser needs to be identified for a more detailed error analysis.
Identifying highest faulty RanoreXPath tree level
Check for RanoreXPath syntax
Check the predicate of faulty the RanoreXPath specification for possible errors:
- Check attributes, values, and operators
- Look for typos, incomplete specifications and wrong values
- Does the RanoreXPath specification contain variables?
- Check if variables are correct and if they are bound to data sources
- Check if the referenced values are correct
Perhaps the attributes and variables are correct, but the path structure itself is faulty, resulting in the UI-element not being found. A good way to solve this problem is by re-tracking the UI-element.
Contact Ranorex support team
If you tried everything to solve the problem, but it still remains – your challenge seems more complex. Therefore, make a snapshot of your solution and contact the Ranorex support team by means of the contact form at