Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the benefits of using Chromeless and Puppeter Over Selenium?

Tags:

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

like image 429
Chris Morancie Avatar asked Jul 22 '18 20:07

Chris Morancie


People also ask

Which is better Puppeteer or Selenium?

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.

What is faster Selenium or Puppeteer?

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.

What is the purpose of Puppeteer?

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.

Is Puppeteer based on Selenium?

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.


1 Answers

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.

like image 134
AJC24 Avatar answered Oct 10 '22 00:10

AJC24