I want to build a desktop application using Electron that can automate web tasks based on what users enter in the interface. I’ve been looking into different options and found that Puppeteer and Playwright might work well for this.
My main goal is to make something that people can just download and use right away without having to install extra stuff or mess with system settings. I’m worried that if I use external tools, users might need to download additional drivers or configure their environment.
What’s the best way to bundle everything together so it works out of the box? Are there any automation libraries that work better with Electron for this kind of thing?
I built a similar app and hit the same bundling issues. Use puppeteer-core instead of regular puppeteer and bundle Chromium directly with your Electron app. Users won’t need Chrome installed or any extra drivers.
In package.json, include puppeteer during build but set it to download the browser binary into your app bundle. Then point puppeteer-core to that bundled Chromium path when launching.
Way more reliable than relying on whatever browsers users have installed. Just heads up - bundling Chromium adds ~150MB to your final package.
Also add solid error handling for when automation breaks due to site changes or network problems. Desktop app users expect things to just work, unlike web tools.
Electron’s built-in webContents API might be all you need - no extra dependencies required. I shipped an automation tool last year using just the executeJavaScript method with hidden BrowserWindow instances. Keeps your bundle lean and avoids compatibility headaches.
You’re limited to standard DOM APIs, but that covers most automation tasks - form filling, clicking elements, data extraction. Works great for typical use cases. Need concurrent operations? Just spin up multiple hidden windows.
If you absolutely need advanced browser automation features, go with the bundled Chromium approach. But I’d start with native Electron capabilities first. You might be surprised what you can pull off without the extra overhead.
playwright beats puppeteer for cross-browser support if u need that. ships with its own browser binaries too, so no dependency headaches - just expect a hefty download. some folks use selenium-webdriver with electron, but the setup’s a pain for end users.