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

1

7

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

Zebapda answered 22/7, 2018 at 20:33 Comment(6)
See #4 in the "some questions are still off-topic" list at stackoverflow.com/help/on-topic, specifically regarding requests for tool recommendations. We try to avoid flamewars, and tool recommendation requests tend to get into that area quickly (also, back when they were allowed, we had lots of authors spamming fake questions, answered by some library they'd written and were selling). See Software Recommendations for a SE community where such questions are welcome; the check their own on-topic page for guidelines.Micaelamicah
I don't get how i can rephrase the question. I honestly want to be pointed along the right path here. What can one thing do and the other cannotZebapda
The lack of Selenium is actually the benefit. It's a fifth wheel with peculiar API that is absolutely superfluous if all you need is to control headless Chrome. Selenium s still indispensable for extensive browser support. However, I see posts online indicating that the same can be done with Selenium - do the measurements and decide yourself. Since it's a deadwood, you can expect footprint and performance improvements.Thickhead
Hmm, interesting, I am trying to put the pieces together so please bear with me. Are you saying that Chromeless itself has a smaller footprint ? Also it sounds that you are saying that the Chromeless API is much for elegant whilst Selenium has become bloated.Zebapda
@ChrisMorancie I don't use Chromeless myself but obviously its footprint is lesser than Selenium's (itself + JRE + driver + bindings). Same applies to Puppeteer, it also takes care of installing portable Chrome copy. And obviously they are more efficient because there's no overhead. I cannot guarantee that Chromeless covers all Selenium features, but Puppeteer presumably does.Thickhead
@ChrisMorancie if other options are possible, i can share some info about intoli remote browser and expand to an answer.Razzia
M
5

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.

Menswear answered 23/7, 2018 at 7:58 Comment(2)
Thanks @AJC24. This lines up with what my team is now telling me. Very well put !!Zebapda
No problem! Very happy to help. Puppeteer is great. Really simple to use and very powerful.Menswear

© 2022 - 2024 — McMap. All rights reserved.