Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesYou can automate an Electron app’s renderer UI with Selenium WebDriver and ChromeDriver. The key difference from ordinary browser automation is that you must connect Selenium to the running ChromeDriver server and tell ChromeDriver which Electron executable to launch. Match the driver to your Electron release, use the correct executable path for your build and operating system, and shut the WebDriver session down when the test ends.
What you need for Selenium automation
- An Electron app build to test and its Electron executable path.
- Node.js, the
selenium-webdriverpackage, and an Electron-compatible ChromeDriver. Electron’s guide uses theelectron-chromedriverpackage. - A ChromeDriver process listening at an address your Selenium test can reach. The Electron guide’s example uses
http://localhost:9515; the address in your builder must match the server’s actual address and port.
Electron’s automated-testing guide says Selenium usage is like testing a normal website, except that you manually specify how to connect to ChromeDriver and where the Electron binary is. See the Electron automated-testing guide.
Install and align the packages
In your project, install Selenium WebDriver and Electron’s ChromeDriver package:
npm install --save-dev selenium-webdriver electron-chromedriver
The Electron-maintained electron/chromedriver repository describes electron-chromedriver as downloading ChromeDriver for Electron and says its major version tracks the Electron major version. Select and verify a release compatible with the Electron version your project actually uses; do not copy an old version number from a documentation sample.
PC 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 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute#1 Best Overall
Electron’s guide prints ChromeDriver v2.10.291558 in an example terminal session. That is historical sample output, not a current recommendation. Likewise, 9515 is the guide’s example port, not a requirement. Confirm which driver executable your installed package provides and how it should be started for that version and project setup.
Start ChromeDriver and connect Selenium to Electron
Start the ChromeDriver executable supplied for your Electron-compatible setup, then build a Selenium session using the same server URL and the actual Electron executable path. The following is the connection pattern documented by Electron:
const webdriver = require('selenium-webdriver')
const driver = new webdriver.Builder()
.usingServer('http://localhost:9515')
.withCapabilities({
'goog:chromeOptions': {
binary: '/path/to/your/Electron-app-executable'
}
})
.forBrowser('chrome')
.build()
Replace the binary value with the executable for the app build under test. The macOS path shown in Electron’s guide is an example, not a portable path: locate the executable inside your own packaged app or development build. Keep the usingServer() URL aligned with the host and port where ChromeDriver is listening.
Rank #2
The guide notes that .forBrowser('electron') applied only to selenium-webdriver versions at or below 3.6.0. For current work, follow the API for the version of selenium-webdriver installed; do not copy that historical browser-name setting into a newer setup without checking its compatibility.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Write a test, wait for the UI, and clean up
Once the session is built, use WebDriver commands to navigate and interact with the app’s renderer, just as you would with a webpage. Replace the sample URL, selector, and expected text with elements and behavior that exist in your application.
const { By, until } = require('selenium-webdriver')
async function runTest() {
const driver = new webdriver.Builder()
.usingServer('http://localhost:9515')
.withCapabilities({
'goog:chromeOptions': {
binary: '/path/to/your/Electron-app-executable'
}
})
.forBrowser('chrome')
.build()
try {
await driver.get('file:///path/to/your/app-page.html')
const heading = await driver.wait(
until.elementLocated(By.css('h1')),
10000
)
console.log(await heading.getText())
} finally {
await driver.quit()
}
}
runTest().catch(error => {
console.error(error)
process.exitCode = 1
})
This is a basic structure, not a universal Electron launch recipe: use the navigation target and selectors appropriate to the app and test environment. The important lifecycle points are to wait for the condition your test needs and to call driver.quit() even when an assertion or interaction fails, so the WebDriver session is closed.
Rank #3
Understand Selenium Manager’s role
Selenium documents WebDriver as its core browser-automation interface. Its documentation describes Selenium Manager as automating driver and browser management for Selenium bindings by default: Selenium documentation. Electron’s guide, however, separately calls for an Electron binary path and Electron-oriented ChromeDriver configuration. The cited guidance does not establish that Selenium Manager automatically resolves Electron/ChromeDriver compatibility or launches your app, so retain and verify those Electron-specific settings.
When to choose another Electron test framework
If you are choosing a stack rather than extending an existing Selenium suite, compare whether tests must launch and shut down the app, access Electron APIs beyond renderer interactions, and support the project’s Electron release. Electron’s automated-testing documentation also covers these options:
| Option | What the cited Electron documentation establishes | Relevant consideration |
|---|---|---|
| Selenium WebDriver | Connect to ChromeDriver and provide the Electron binary path. | Useful when your tests use Selenium, but preserve the explicit driver and binary configuration. |
| WebdriverIO | Electron’s guide covers a workflow that can launch and shut down the app and expose Electron APIs to tests. | Consider it when app lifecycle management or Electron API access is central to the test suite. |
| Playwright | Electron describes its support as experimental and says it uses Electron’s Chrome DevTools Protocol support. | Evaluate the experimental status against your compatibility and stability needs. |
| Spectron | The repository is explicitly marked deprecated; its README describes its historical Application wrapper and limitations. | Legacy context for maintaining an existing suite, not a default for new work. |
See the Spectron repository for its deprecation notice. Avoid selecting it for a new test suite.
Rank #4
Troubleshoot common setup failures
Selenium cannot connect to ChromeDriver
Check that ChromeDriver is running and that the host and port in usingServer() match its listening address. If the driver is not listening on localhost or uses a different port, update the builder URL accordingly.
The app does not start or the wrong app opens
Verify that goog:chromeOptions.binary points to the executable itself for the build under test, not merely the containing directory or an assumed path copied from another operating system. Use the app’s actual packaged or development executable.
Driver and Electron are incompatible
Check the Electron version in the project and the compatible electron-chromedriver release. The package’s major version tracks Electron’s major version; do not rely on the old ChromeDriver version printed in the guide’s sample output.
Best Value
The test fails before an element appears
Confirm that the test navigates to a page or app route that exists in its environment, then wait for a meaningful UI condition rather than assuming the renderer is ready immediately. Use selectors that match the app’s rendered DOM.
Processes remain after a failing test
Put test actions in a try block and call driver.quit() from finally. This ensures Selenium attempts to close the session regardless of whether a wait or assertion fails.
Or skip the browser setup
If your goal is to capture a website rather than test an Electron app’s interactive renderer, ScreenshotNeo provides a one-request screenshot API and an MCP server for AI agents. It is not a replacement for Selenium-based Electron UI tests. A basic capture request is:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for setup and options. Before capture, it accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of these steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the page verdict and billing status in headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.
Quick 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.




