We are looking to replace our Selenium approach to automated web data collection and have been recommended Puppeteer or Chromeless.
One of the things I like is the ability to go headless with chrome running on AWS lambda. That reason was sold as the main reason for going with Chromeless or Puppeteer. However, I see posts online indicating that the same can be done with Selenium. If that is true, what over advantages do Chromeless and Puppeteer offer over Selenium ?
We are going to be using NodeJS
The choice between Selenium and Puppeteer boils down to your needs. If your primary focus is testing browser applications, especially on multiple browsers, Selenium is a better choice. It is purpose-built for cross platform testing. If you are exclusively focused on Chrome and JavaScript, Puppeteer is a better fit.
With its high-level API control over Chrome and Chromium, Puppeteer offers great control over these browsers and is comparatively faster than other testing tools, even Selenium.
Puppeteer is a Node library which provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome or Chromium.
Puppeteer only supports Chrome and Chromium. This plays back to their different goals. Selenium is a web-UI testing library, while Puppeteer is a remote control library for Chrome. There is an experimental library adapting Puppeteer support for Firefox, but it's explicitly not ready for production use.
Having used both Selenium and Puppeteer, these would be my observations as to why it's currently being recommended so highly:
node
towards your scripts and watch it go. Everything even runs in parallel!jest
and mocha
.headless
to false
and turn slowMo
up from 0
to, say, 250
and you can easily see what's going on and fix any problems you may have.It should be noted that Selenium does do everything that Puppeteer does (and vice versa) but that's not the point of Puppeteer. Puppeteer allows for a team to build a large library of automation scripts very quickly using an easy to use API and get tests running now rather than having to deal with building ultra-robust test frameworks which work cross browser and / or cross device.
If you really must have cross browser testing then Selenium or perhaps InternJS (a personal favourite of mine) are still the choices to make.
Puppeteer only supports executing tests on Chrome but, at the end of the day, it's much better to have a lot of tests running (even if it's just on Chrome) as opposed to having none.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With