Having used both Selenium and Puppeteer, these would be my observations as to why it's currently being recommended so highly:
- Puppeteer is really easy to configure and execute. No setting specific drivers required. Just write your test scripts, point
node
towards your scripts and watch it go. Everything even runs in parallel!
- It's a zero setup framework in that it comes bundled with the version of Chromium which it runs best with.
- Another benefit is speed. Puppeteer is really fast since it uses headless Chrome.
- It integrates very nicely with other popular test frameworks such as
jest
and mocha
.
- Using Puppeteers API is really straightforward. Everything is simple to write, easy to understand and basically allows for simple user interactions to be automated using a single line of code.
- It's really easy to debug your automation scripts. Simply set
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's easy to pick up and use no matter what your previous experience levels: on the team I'm working on, everyone (even those with no real automation test script writing experience) has found working with Puppeteer a really nice and relaxed experience. Everyone is getting the grasp of it within a few minutes of basic research and getting scripts running quickly and with no hassle or stress.
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.