335 points · by amjd · 7y ago · 127 comments
> 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.
Disclosure: Chrome DevTools docs guy
Then it gets upvoted to a more general audience, who ask "Puppeteer? what's that?"
At the end of the internship I handed over everything I'd built by that point, with the idea that they (Mozilla) would turn it into a finished project. But I never saw any activity on that front after I left, so I assumed the idea'd been scrapped. Feels very weird seeing this pop up out of the blue on HN today.
[0] https://bugzilla.mozilla.org/show_bug.cgi?id=1523104#c1
[1] Complete with documentation comment generation; I found the result of running rustdoc over that crate super useful as an alternative to the official CDP docs site: https://www.spinda.net/files/mozilla/rust-cdp/doc/cdp/index....
Edit: I actually have no right to comment on what stalled your project and have no idea what happened there. I just wanted to discuss the fact that we need a good abstraction layer but seem stuck in debate.
Disclosure: Chrome DevTools docs guy, just speaking personally based on my research into the topic over the last year
I also used to build a desktop app that my team uses to download Alexa Flash Briefing metrics (because there's no API for that)
Puppeteer's full-screen screenshots & DOM manipulation abilities are clutch!!
CasperJS was OK, even better with Nightwatch but Puppeteer is quicker, more stable and actively developed.
Sometimes I want to directly control a browser to run a test or examine a UI component, but I still want to mock parts of my application. This is one of the biggest weaknesses with Selenium -- it takes a very narrow view of what testing is, so it becomes much less useful as soon as you're trying to do anything interesting.
Different applications call for different testing strategies. Selenium could be a low-level browser controller that allows you to write strict E2E tests, but instead it's a low-level browser controller that is almost fanatical about only supporting strict E2E tests, even when it means that basic actions need to be more complicated. I think that's a design mistake, but whatever.
My conspiracy-laden mind veers towards the obvious but I'd prefer a better explanation.
I've also noticed that sometimes (in CI, less than 5% of the runs) the installation or run will fail deep in chromium. It's actually spawning a chrome process and tunneling remote commands to the child process to do work, so, I guess the flakiness is (almost) excusable?
Restarting the test always resolves the issue, fwiw.
The experiment was a great start to see what is needed to support Puppeteer. The next step is coming up with a well-integrated architecture. Find me on the web to talk to me about your use cases and ideas for Puppeteer.
If you want to record your own scripts, I also am actively developing https://checklyhq.com/Puppeteer-recorder, a Chrome extension.
Checkly looks like a great product!
Love recording macros
Selenium has it's quirks but when you understand how it works and it's limitations and user centric philosophy there is nothing that can stop you from writing rock solid stable tests.
I’m seriously thinking there is a cloud api play in the near future — a puppeteer Page is a pretty awesome container format ... a Puppeteer Page or BrowserContext per request would provide an awesome cloud-function-like programming model I think...
Or did you mean something else?
Disclosure: Chrome DevTools docs guy
"The Firefox Remote Protocol is a low-level debugging interface based on the CDP protocol."
Chrome has invested massively in developer tools for chrome and it's shows.... I think chrome is the best software ever written. The developer tools are so powerful that it'd hard to even know the full breadth of what's in there.
Firefox offers nothing to developers over chrome, which is sad.
Firefox has multi-account containers. Having different tabs logged in to different accounts is huge for me.
Firefox allows you to have each tab open in a different container, and they don't have to be tied to anything in particular.
I can have different tabs open to the AWS console for each AWS account I use. I can also switch tabs to change between different user accounts to test interactions between users on the site I'm developing.
Vimium/cVim just doesn't match up and aren't under as aggressive development. For this keyboard-focused developer, there's not a good enough reason to be on Chrome. I know I am in the minority, but it's a point nonetheless.