Testing of CEF applications
You can test web content in desktop applications that are based on these Chromium-based frameworks:
- Chromium Embedded Framework (CEF)
- Qt WebEngine
Enable the remote debugging port
To start testing CEF applications with Ranorex Studio, you have to enable the remote debugging port in the application under test (AUT).
You can do so by using the command line argument ‘remote-debugging-port’ when starting the AUT. For example: MyApplicationUnderTest.exe –remote-debugging-port=8081
The port number you are using in this command must not be used by another application or service on the windows machine you are testing the AUT.
In a recording module, you can add this command line argument to the ‘Run application’ action.
If your AUT is based on CefSharp, the command line argument does not work. Please enable the remote debugging port in the source code of the AUT.
To set the remote debugging port in CefSharp, you have to specify it with help of the CefSettings class before initializing the control like this:
var settings = new CefSettings(); settings.RemoteDebuggingPort = 8081; Cef.Initialize(settings);
If you want to automate a JxBrowser application, simply passing the remote debugging port via command line won’t work. You need to enable it in the source code of the AUT by calling the BrowserPreferences.setChromiumSwitches(String…) method.
Please refer to this article in the official JxBrowser documentation to see how.
When testing CEF applications, you may come across a technology warning. Here are potential causes for these technology warnings:
Another application is already listening on the remote debugging port
If another application on the machine is already listening on the remote debugging port of the application under test, Ranorex cannot connect to the AUT.
By Default, Ranorex tries to close these applications. In some cases, like the Chrome Developer Tools, this is not successful. That is why a manual action from the user is needed.
Please try to:
- Close all other applications, like the Chrome Development Tools, that may have a connection to the application under test at the remote debugging port.
- Choose a different port number as remote debugging port for the application under test.
CEF UI element invisible
The UI element containing the CEF control is not visible. In order to test the web content inside the CEF control, the containing UI element has to be visible.Please try to
- Include an action in your recording to make sure the UI element is visible.
Remote debugging not available
The remote debugging interface of the application under test is not available. However, this is a prerequisite for testing CEF applications with Ranorex.
Please try to:
- Make sure the application under test is correctly prepared.
- The port number used as remote debugging port must not be used by any other application on the machine.
- Make sure no other application on the machine listens to the remote debugging port the application under test provides.