To capture a CEF application with Selenium, launch the app with Chromium remote debugging enabled, connect ChromeDriver to that app, wait until the state you need is rendered, and call Selenium’s screenshot method. CEF embeds Chromium inside a desktop application, so this is not the same as starting an ordinary Chrome browser. The exact CEF, ChromeDriver, Selenium, and operating-system combination matters; validate it for your application rather than treating an older example as a current compatibility recipe.
How Selenium reaches a CEF application
The Chromium Embedded Framework (CEF) puts a Chromium browser inside another application. The CEF project documentation describes ChromeDriver and Selenium as tools for automated testing of Chromium-based applications. ChromeDriver communicates with the embedded Chromium instance through the DevTools remote debugging protocol, enabled by a command-line argument passed to the application.
That means the workflow has two separate parts: start the CEF executable with a debugging port, then create a WebDriver session configured to use that executable and port. Once Selenium has a working session, its normal browser-context and element screenshot methods can be used.
A CEF project walkthrough demonstrates this pattern in Java, but it is historical: the page describes a Windows tutorial tested with ChromeDriver 2.14 and Selenium Server 2.44.0, and notes that the remote-debugging-port argument was required starting with ChromeDriver 2.41. Those are details about that example, not recommended versions today. The documentation available here does not establish a current compatibility matrix across CEF/Chromium, ChromeDriver, Selenium, and operating systems.
#1 Best Overall
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
Configure CEF and ChromeDriver
First identify how your application starts its CEF process. The application must pass the remote-debugging-port argument to the Chromium-based app process. Use a port that is available on the machine and appropriate for your environment. The CEF tutorial’s sample uses port 12345; the number is an example, not a required setting.
- Enable remote debugging in the CEF launch. Add
--remote-debugging-port=12345to the CEF application’s command-line arguments. If your app constructs CEF settings internally, configure the equivalent command-line argument through its startup path. - Use ChromeDriver options for the CEF executable. Set the binary to your application executable, rather than relying on ChromeDriver to launch a separately installed Chrome browser.
- Match installed versions. Check the Chromium version embedded in the CEF build and choose a ChromeDriver/Selenium combination compatible with that build. The old CEF example is not a version-selection guide.
- Start the WebDriver session and verify it controls the intended app. Navigate or interact only after confirming the session is attached to the CEF instance you meant to test.
Historical Java illustration from the CEF walkthrough
The following shows the shape of the project’s documented setup. It is not a current-version recommendation, nor a promise that the same imports or APIs work unchanged with current dependencies. Replace the executable path with your CEF application path and validate the code against your installed versions.
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class CefScreenshot {
public static void main(String[] args) {
ChromeOptions options = new ChromeOptions();
options.setBinary("C:\path\to\your\cef-application.exe");
options.addArguments("remote-debugging-port=12345");
WebDriver driver = new ChromeDriver(options);
try {
driver.get("https://example.com");
// Interact with the page or application before capturing.
driver.manage().window().maximize();
// Capture after the required application state is ready.
} finally {
driver.quit();
}
}
}
The navigation line is illustrative: a CEF application may start on its own route or load content as part of its UI. Use the navigation and interactions appropriate to your app. The important setup elements are specifying the CEF binary and enabling the remote-debugging port.
Capture the browser context or a particular element
Selenium documents screenshot methods for both the current browsing context and an individual element. Use a context screenshot when you need the visible browser view; use an element screenshot when the test concerns one specific component. Selenium’s screenshot endpoint returns Base64-encoded image data, and the binding’s convenience methods can save that result as an image file.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
- The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
- Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
- G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
- Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
- The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere
Python: save the current context
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
options = Options()
options.binary_location = r"C:pathtoyourcef-application.exe"
options.add_argument("--remote-debugging-port=12345")
driver = webdriver.Chrome(options=options)
try:
# Navigate or perform the actions your application requires.
driver.get("https://example.com")
# Save the current browsing context as a PNG.
if not driver.save_screenshot("cef-page.png"):
raise RuntimeError("Selenium did not save the screenshot")
finally:
driver.quit()
Use the driver setup supported by your local Selenium and ChromeDriver versions; the CEF binary path and debugging argument are the parts specific to attaching this pattern to CEF. Selenium’s documentation also provides screenshot examples in Java, C#, Ruby, and JavaScript. Method names and return behavior vary by binding.
Python: save one element
from selenium.webdriver.common.by import By
element = driver.find_element(By.CSS_SELECTOR, "main")
if not element.screenshot("cef-element.png"):
raise RuntimeError("Selenium did not save the element screenshot")
Choose a selector that uniquely identifies the content you want. If the element is not present yet, wait for it instead of immediately calling find_element. An element screenshot is not interchangeable with a full-page capture: it targets the element’s rendered bounds, while a context screenshot captures the browser view.
Wait for the application state you intend to capture
A successful navigation or WebDriver command does not necessarily mean that asynchronous content, images, or animations have finished rendering. Capture only after the page has reached the state your test is meant to document. Depending on the app, that may mean waiting for a particular element, for an application-specific ready indicator, or for a deliberate delay after an animation.
- Wait for a meaningful selector or visible state rather than relying only on a fixed sleep when the application exposes a reliable readiness signal.
- For content loaded asynchronously, make the readiness condition specific to the content in the image.
- If an animation changes the target, wait until it reaches the intended frame or disable it in the test environment if that is acceptable for the test.
This timing concern is not unique to Selenium. The CefSharp OffScreen API reference warns that its screenshot method can capture a loading render and recommends starting only after the page is loaded, detectable through FrameLoadEnd or a suitable heuristic. That is guidance for CefSharp’s own capture API, not a Selenium guarantee; it reinforces why readiness must be verified for the application being tested.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
- Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
- Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
- Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
- Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
- Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
When CefSharp OffScreen is a better fit
If your app is built with CefSharp and you need a capture directly from its browser control rather than WebDriver-based navigation and interaction, CefSharp’s OffScreen API is a separate route. It is framework-specific and does not create a Selenium session. The reference for CefSharp version 99.2.120 lists CaptureScreenshotAsync as its capture method and marks the older ScreenshotAsync obsolete. It also notes that the older method waits for a next rendering and that bitmap size follows the browser size previously set.
Use Selenium when the task also needs WebDriver-style navigation, element lookup, or interaction and your CEF/driver setup works together. Consider OffScreen capture when you control a CefSharp browser control and want to capture through that framework’s API. The correct choice depends on the application framework, target, and version-specific behavior; neither approach should be assumed to support every CEF configuration identically.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server, not a way to attach to or capture an arbitrary desktop CEF application. If the content you need is available as a web page, one GET request can capture that URL as an image or PDF. See the ScreenshotNeo API documentation for parameters and response details.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
For web-page captures, cookie banners, newsletter popups, and chat widgets are removed before the shot; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and the response indicates the page verdict and billing status. Its MCP server gives AI agents tools for screenshots, page information, and PDF capture. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. These features apply to website capture, not a local CEF application window. Sign up for the free plan.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Troubleshooting Selenium and CEF screenshots
ChromeDriver cannot start or attach
Check that the configured binary is the CEF application executable, that the debugging argument reaches the Chromium process, and that the selected port is available. Then verify the versions you installed against the Chromium version bundled with your CEF build. The historical walkthrough’s version numbers are not evidence that an older driver will work with a current app.
Rank #4
- Computer mouse for easily navigating a computer interface; click, scroll, and more
- USB-A wired connection; if existing device only supports USB-C, an additional adapter will be required
- High-definition (1000 dpi) optical tracking ensures responsive cursor control for precise tracking and easy text selection
- 3 buttons offer effortless fingertip control
- Plug-and-go ready for instant use
The session opens the wrong browser or page
Confirm that setBinary or the binding’s equivalent points to the CEF executable, not a Chrome installation. Also inspect the app’s own startup behavior: it may open a route automatically, so an additional get call may not represent the state you intend to test.
The image is blank, incomplete, or shows a loading state
Make the capture conditional on the application state you actually need. Wait for the target element or a reliable ready indicator, and account for asynchronous rendering or animation. A completed navigation command alone may be too early.
The element lookup fails
Check that the selector matches the DOM in the active browsing context and that the target has appeared before lookup. If the app changes context or loads its UI differently from a conventional page, confirm Selenium is inspecting the expected content before treating the selector as incorrect.
The screenshot is saved but has the wrong scope
Use the driver’s screenshot method for the current browsing context and the element’s screenshot method for a specific element. Confirm the target element’s bounds and the active context before capture; these methods serve different purposes.
Best Value
- 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
- 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
- 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
- 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
- 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.
Frequently asked questions
How do I use Selenium with a CEF application?
Enable Chromium remote debugging in the CEF app launch, configure ChromeDriver to use the CEF executable, create a WebDriver session, and then use Selenium’s normal navigation, interaction, and screenshot methods. Validate the exact version combination locally.
Can I use this approach on every CEF application?
The available project documentation does not establish universal compatibility. CEF build, bundled Chromium, driver, Selenium binding, and application startup behavior can differ, so successful operation in one setup should not be treated as a guarantee for another.
Does ScreenshotNeo capture a local CEF desktop window?
No. ScreenshotNeo captures websites from URLs. It can be relevant if the content is available as a web page, but it does not replace Selenium or a framework-specific API for capturing a local desktop application.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

