If Ranorex Studio cannot recognize elements in a .NET WPF application, review the privilege configuration, WPF plugin mode, and element tree used for identification.
Ranorex and the AUT use different privilege levels
Ranorex Studio and the application under test (AUT) must run with the same privilege level.
Close the AUT and all Ranorex tools. Then, restart them using the same privilege level. If the AUT requires administrator privileges, run the Ranorex tools as an administrator as well.
Ranorex tools use different WPF plugin modes.
Object recognition may be inconsistent when the WPF plugin mode used by a standalone tool, such as Ranorex Spy, does not match the mode configured for the solution.
To verify the configuration:
- Open the solution in Ranorex Studio and select Settings.
- Go to the Plugins tab and select Solution Settings.
- In the WPF section, note the value of WPF Legacy/UIA Interaction.
- Open the standalone Ranorex tool.
- Open Settings, select Solution Settings, and locate the WPF section.
- Set WPF Legacy/UIA Interaction to the same value used by the solution.
- Select OK.
The improved WPF plugin is enabled by default for new solutions and is recommended for new projects. Avoid mixing repository items created with different WPF plugin modes because this can cause conflicts.
For more information, see Improved WPF Plugin.
A UIAutomation element is selected instead of a WPF element
Ranorex Spy may display both UIAutomation and native WPF representations of the same application window.
If the selected element has the UiAutomation capability:
- Locate the window in the element tree.
- Select the preceding sibling, the item directly above the selected window.
- Verify that the selected representation has the
WpfElementcapability. - Track the element again using the WPF representation.
The native WPF representation generally provides additional attributes and more stable object identification.