This article outlines how to create diagnostic files for the Ranorex support team and provides a workflow for resolving common "element not found" errors.
Create diagnostic files
If you need help from the Ranorex support team, provide these files to help them reproduce your issue.
Create a Ranorex snapshot
A snapshot captures the user interface (UI) structure of an application under test (AUT) at a particular point in time. It contains all interface elements, as well as their hierarchy and values. You can create and view a Ranorex Snapshot file with Ranorex Spy. The file extension is .rxsnp.
For more information, see Snapshot Files.
Create a compressed Ranorex solution
A compressed Ranorex solution is a file archive including all relevant files of a solution. This solution is created by a built-in compression function which works similarly to any other compression software. To create a compressed solution:
- Open your solution in Ranorex Studio.
- Go to the Tools menu and select Compress solution and open folder.
The application creates the compressed solution in the solution folder.
- Project file folder before the creation of a compressed Ranorex solution
- Project file folder with the compressed Ranorex solution (
Introduction.zip)
Create a compressed Ranorex report
A compressed Ranorex Report is one zipped file including all files that belong to a single report. These are the report file itself (*.rxlog), all images, and further relevant files. The file extension is ‘.rxzlog‘.
To configure Ranorex to automatically create a compressed copy of every report that is created, do the following:
- Select the test suite and open the context menu
- Click Properties in the context menu
- In the settings window, click the Report tab.
-
Check the Create a compressed copy of the report option.
The application saves the compressed Ranorex report file in the output folder of the project file structure.
-
Destination folder
The output folder of the solution isbin\Debug
This is where you can also find the compressed report copy -
Compressed report copy
See the compressed report copy with the '.rxzlog' extension
The naming conventions are the same as for regular reports
You can also manually create a compressed report from any generated report as follows:
- Open the context menu in a created report in Ranorex Studio.
- Select Save as….
- Select a destination folder.
- Optionally, change the name of the file.
- Click Save.
In the confirmation window, it’s important to review the following and then click OK:
- The destination folder
-
The file name for the compressed report and the according file extension
.rxzlog
The application generates the compressed report file in the designated destination folder.
Fix the ‘element not found’ error
The “element not found” error (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 guide helps you identify the most common causes of the error and resolve them so your test executes successfully.
Step 1: Analyze report
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.
When you encounter the ENF error, report analysis is the first thing to do.
Step 2: Inspect screenshot
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 one of the following scenarios according to your analysis:
- Scenario 1: The UI element is NOT in the screenshot
- Scenario 2: The UI element is IN the screenshot
Scenario 1: The UI element is NOT in the screenshot
If the UI element is not in the screenshot, it means that your AUT is not in the correct state for Ranorex to find the UI element 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 causes the UI-element to be there during some runs, and not during others.
Solution
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 Ranorex is still not able to find the UI element, review Scenario 2.
Scenario 2: The UI element is in the screenshot
If the UI element is in the screenshot, it means that your AUT reaches the correct state for Ranorex to find the UI element within the timeout. However, it is still not able to because 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.
Solution
Check the RanoreXPath specification of the UI element.
- Ensure the AUT is in the same state as when the ENF error occurred.
- Select the repository item and click EDIT IN SPY to open it in Ranorex Spy.
- Identify the highest faulty level in the UI-element tree browser for more detailed error analysis.
- Check the predicate of faulty RanoreXPath specification for possible errors:
- Check attributes, values, and operators
- Look for typos, incomplete specifications, and wrong values
For more information, see RanoreXPath Basics.
- Check if the RanoreXPath specification contains variables. If so:
- Check if variables are correct and if they are bound to data sources
- Check if the referenced values are correct
For more information, see Define Test and Variables.
- If attributes and variables are correct, it is possible that the path structure itself is faulty. Re-track the UI element to solve the issue.
For more information, see UI Elements Identification.
Contact Ranorex support team
If the issue remains, make a snapshot of the solution and contact the Ranorex support team using the support query form.