Before you can test CEF applications, you need to prepare it for testing.
Instrument CEF Application
TestLeft can automatically expose elements in CEF-based applications. To do this, launch your application from your tests while one of the following conditions is met:
The application’s executable imports the libcef.dll library.
— or —
The libcef.dll library and the application’s executable are located in the same folder.
— or —
The application has the
injectCefHookcommand-line argument (in any letter case and with any prefix).
IProcess process = Driver.Applications.Run(@"C:\cefclient.exe", "-injectCefHook");
Visual Basic .NET
Dim process As IProcess = Driver.Applications.Run("C:\cefclient.exe", "-injectCefHook")
TestProcess process = driver.getApplications().run("C:\\cefclient.exe", "-injectCefHook");
This is the recommended way to work with CEF-based applications.
Disable Windows (Off-Screen) Rendering
A CEF application can use windowed or windowless (off-screen) rendering. TestLeft supports CEF applications that use windowed rendering. Windowless (off-screen) rendering mode is supported only for WPF components of the CefSharp framework. Other applications that use windowless rendering are not supported. If your application uses windowless rendering, you need to disable it for testing purposes.
The way you disable windowless rendering depends on the programming language and framework used. Refer to the documentation of your CEF framework for details.
Verify CEF Support
Start your tested application and examine it in the TestLeft UI Spy. The application’s object hierarchy must include a
Page object to automate web pages and web page elements in the application’s embedded web browser.
.NET applications created with CefGlue are not supported.
Windowless (offscreen) rendering mode is supported only for WPF controls of CefSharp applications. Other applications that use offscreeen rendering are not supported.
If the script injection is restricted by Content Security Policy (CSP) in your tested CEF application, TestLeft will not be able to access internal objects of the application.
TestComplete cannot perform
ClickItemactions on ListBox controls in applications based on CEF3 builds 1650 and 1750. This behavior is caused by an issue in the Chromium engine and was fixed in CEF build 1916. As a workaround, you can select items of ListBox controls by calling the
Keysaction:aListBox.Keys("[Down][Down]") // Select the second item in the list
aListBox.Keys("myItem") // Input the desired value
If you face issues when accessing GUI objects in your CEF application, make sure the
LoadHandlerinterfaces are implemented in your application.