Puppeteer vs Selenium
As you might expect from us as the builders of a browser automation product, we know a thing or two about browser automation frameworks!
Puppeteer and Selenium are two of the most popular. The venerable Selenium is perhaps the best known - it’s been around since 2004.
Puppeteer is a relative newcomer, having launched in 2017, but as of 2022 it’s mature software with a developed ecosystem.
In contrast to axiom’s no-code approach, each framework is designed for building automations with code, and are often used for automating test cases.
A fun-fact is that Axiom is built on puppeteer! But that doesn’t mean we show favouritism - Selenium and Selenium IDE were the original tools which inspired axiom, so will always have a special place in our hearts ❤️ (opens new window). It’s likely that Selenium will always be synonymous with browser automation.
Here’s our summary of both frameworks - it may help you choose which one is best for you.
|Browser Platform||Chrome, Chromium and Chromiium-derived browsers like Brave||Selenium webdriver supported across FireFox, Chrome, Internet Explorer, Safari, Edge, Opera|
|License||Apache 2.0||Apache 2.0|
|Developed & Maintained by||Open-source community|
|No-code Solution / Builder||Chrome DevTools now let’s you export puppeteer scripts. There are also unofficial chrome extensions which try to do the same.||Official ‘Selenium IDE’ Available for Chrome and FireFox|
✅ Strong integration with Chrome ecosystem
✅ Tight integration with node.js ecosystem
|✅ Supports multiple browsers |
✅ Supports testing browser extensions
✅ Native support for multiple programming languages
|Cons||❌ Chromium-only |
❌ Poor support for testing browser extensions
|❌ More complex - requires language bindings + webdriver|
# Which framework is right for me?
Reasons to use Selenium:
- You have a testing-focused project
- You need to support multiple browsers - e.g cross-browser testing
- You need to automate or test browser extensions.
- Although axiom’s automations are built on puppeteer, we need to use Selenium to test the Chrome extension!
Reasons to use Puppeteer:
- You have an automation-focused project (including scraping)
- You need a simpler architecture and setup (e.g. fewer dependencies + manage all dependencies with npm)
- You’re building on the node.js ecosystem
- Your project is focused on Chrome, and you’d like to take advantage of the chrome ecosystem:
- Chrome’s in-built puppeteer recorder
- Chrome’s headless mode
- Puppeteer’s ‘stealth’ project, which (tries to) prevent headless detection
- Chrome’s remote desktop
# Neither of these seem like a good fit for me!
If neither of these seem like a good fit, luckily there’s plenty of other ways to automate the browser (including axiom.ai (opens new window) of course 😉).
This GitHub list is a pretty good resource to find other tools and frameworks that might suite you better:
https://github.com/angrykoala/awesome-browser-automation (opens new window)