Live data from Hacker News

Puppeteer: Headless Chrome Node API

github.com

61–70 of 105 posts

Re: Puppeteer: Headless Chrome Node API

#61
post #60
post #33

I'm a little concerned about the confusion in the market of another product in the automation space called "Puppet"-something. The project itself looks exciting.

I can imagine using Chrome Puppeteer in conjunction with Google Puppeteer https://github.com/google/puppeteer The latter having been renamed from "puppet" when Google open-sourced it.

I can imagine provisioning the testing boxes for that whole thing with Puppet. https://puppet.com/

Re: Puppeteer: Headless Chrome Node API

#62

Has anyone found something similar but for Python? The few I found all seemed to be abandoned or too limited in capability.

I've been working on something similar (Headless Chrome via DevTools protocol) called Webfriend. It is a Python wrapper to the DevTools protocol, as well as a simplified imperative scripting environment which is specifically built for ease of use by people with a technical-but-not-programming background (lovingly called Friendscript).

It's by no means done, but it is functional and I'm hoping to see the project grow beyond a toy if there's interest in the community.

Things to note:

- Documentation is there, but there are gaps (especially w.r.t. the Python API.) I'll eventually get around to wrestling with Sphinx, et. al., but have not as of yet.

- Targets Google Chrome / Chromium 58.x - 60.x. No testing outside of those versions has occurred.

- Is Chrome only for the moment, but may evolve to work with WebDriver and other browser APIs in the future.

https://github.com/ghetzel/webfriend

Also, PRs and issues are welcome, but my time to work on this is limited at the moment (which does speak to the point made elsewhere about corporate backing vs. individual maintainers, but this was built largely to scratch an itch.)

Re: Puppeteer: Headless Chrome Node API

#63
This is great, but it's sobering to see how hard it is to get a nice, "complete" PDF screenshot out of a modern site.

Here's a quick hack: https://gist.github.com/rcarmo/cf698b52832d0ec356c147cf9c9ad...

I'm using The Verge for testing because it lazy loads images, and am being clumsy about the scrolling, but it mostly works - I can get 90% of the images to show on the finished PDF.

What I can't seem to get right, though, is creating a single-page PDF where the page height matches the document height perfectly - it always seems to be off by a bit, at least on this site (mine works fine, _sometimes_).

Anyone got an idea of why this is so?

Re: Puppeteer: Headless Chrome Node API

#64
post #2

I think simple-headless-chrome is more far along https://github.com/LucianoGanga/simple-headless-chrome

We're fans of LucianoGanga's project (and of Chromeless, Doffy, Chrominator, Chromy, Navalia). I can tell you from personal experience that dealing with the raw DevTools Protocol isn't ideal for a developer writing an automation script, so it's clear there's demand for libraries with this higher-level API. Would love to know if there's a feature parity concern you have or what you'd like to see from puppeteer (or any…

We're mainly using these things for screenshots of existing corporate intranet tools that are then surfaced to slack. Headless chrome is finally giving us screenshots that are actually authentically what you would actually see on the screen. PhantomJS came close but still has issues.

Re: Puppeteer: Headless Chrome Node API

#65
post #60
post #33

I'm a little concerned about the confusion in the market of another product in the automation space called "Puppet"-something. The project itself looks exciting.

I can imagine using Chrome Puppeteer in conjunction with Google Puppeteer https://github.com/google/puppeteer The latter having been renamed from "puppet" when Google open-sourced it.

I believe they're referring to https://puppet.com

EDIT: Left the tab open too long, beaten to the punch by 20 minutes.

Re: Puppeteer: Headless Chrome Node API

#66
post #9

So first there was Selenium's JSON Wire protocol, then came the W3C WebDriver spec and now we're back to browser-specific implementations? As someone who's tried/is trying to automate Firefox/Chrome/Safari/IE in a consistent fashion, my only question is: WHY?

I do a lot of web scraping that requires a full browser for some websites. This sounds perfect for me. I often use Selenium, but it's a lot of complexity and quite buggy if I just want to run chrome (or any one browser, but not all browsers).

Have you tried TestCafe? I have had good experience with TestCafe on a recent project. The development team are very responsive to bug fixing and stability.

Re: Puppeteer: Headless Chrome Node API

#68
post #49

Can you help with one of the existing API's that does the same thing instead of inventing a new one?

Actually the release of Puppeteer is a really exciting development. I've been waiting for some time for something like this to happen. We've seen what happened to PhantomJS (almost 2k open issues and main maintainer stepping down without a successor), NightmareJS (lots of unreplied issues for months, probably the project is not a strategic part of Segment) and so on. In theory it is great for an individual or an esta…

Yep. Pat Meenan's herculean / ultramarathon support of WebPageTest is a remarkable exception. (Speaking of WPT, after just a cursory glance at this thread on my phone prior to thumbing this comment, it surprisingly hasn't been mentioned yet? shrug)

Re: Puppeteer: Headless Chrome Node API

#69
post #49

Earlier quoted context omitted.

Actually the release of Puppeteer is a really exciting development. I've been waiting for some time for something like this to happen. We've seen what happened to PhantomJS (almost 2k open issues and main maintainer stepping down without a successor), NightmareJS (lots of unreplied issues for months, probably the project is not a strategic part of Segment) and so on. In theory it is great for an individual or an esta…

Yep. Pat Meenan's herculean / ultramarathon support of WebPageTest is a remarkable exception. (Speaking of WPT, after just a cursory glance at this thread on my phone prior to thumbing this comment, it surprisingly hasn't been mentioned yet? shrug)

I just recently got to know WebPageTest. It even has scripting abilities! I'm just surprised why the project didn't enter into mainstream (in the sense that an average test automation guy like me will know).

Re: Puppeteer: Headless Chrome Node API

#70
post #12

One of the biggest wins here is this little tidbit: > When you install Puppeteer, it downloads a recent version of Chromium (~71Mb Mac, ~90Mb Linux, ~110Mb Win) that is guaranteed to work with the API. A lot of the chrome interface libs about at the moment require you to maintain your own instance of chrome/chromium and launch the headless server with your command line, or require a pre compiled version, that can qui…

There is complexity here you may not be seeing, namely if you are on a platform without X, it will not work. Normal chromium requires a bunch of X libraries be present. It doesn't use them, but for things like headless testing, it's a massive pain, since the apt-get (or equivalent) is generally many hundreds of megabytes.

X: The First Fully Modular Software Disaster

http://www.art.net/~hopkins/Don/unix-haters/x-windows/disast...

Post reply on HN