Ranorex cannot detect DOM elements in Chrome or Edge
If Ranorex 12.x cannot detect any DOM elements in Google Chrome or Microsoft Edge, the cause may be a browser policy that blocks user-level native messaging hosts.
The DOM is the internal structure of a web page, including elements such as buttons, input fields, links, and other controls. Ranorex requires access to the DOM to identify and interact with web elements.
If this access is blocked, Ranorex Spy may detect only the browser window, but not the individual elements inside the page.
Symptoms
You may be experiencing this issue if:
- Ranorex Spy cannot detect any web elements in Chrome or Edge
- The browser opens correctly, but the DOM is not visible in Ranorex Spy
- Ranorex can see the browser process, but not buttons, fields, links, or other page elements
Cause
This issue can occur when the browser policy NativeMessagingUserLevelHosts is set to block user-level native messaging hosts.
If this policy is disabled, the Ranorex native messaging host process cannot be started by the browser. As a result, Ranorex cannot access the DOM.
Workaround
Check the following registry paths:
For Microsoft Edge:
HKEY_CURRENT_USER\Software\Policies\Microsoft\EdgeHKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge
For Google Chrome, check the equivalent Chrome policy paths used in your environment.
Look for the following registry value:
NativeMessagingUserLevelHosts
If NativeMessagingUserLevelHosts is set to 0, user-level native messaging hosts are denied. This prevents Ranorex.Plugin.ChromeMsgHost.exe from being started by the browser, which means Ranorex cannot detect the DOM.
Set NativeMessagingUserLevelHosts to 1.
This allows user-level native messaging hosts. After changing the value:
- Restart the browser.
- Restart Ranorex.
- Open Ranorex Spy and check whether the DOM can now be detected.
If Ranorex Spy can detect the DOM after changing the policy, the issue is confirmed to be caused by the browser policy.