News for hackers. Stuff that matters.
Re:A list of headless web browsers by riston on Tuesday November 08, 2016 @06:02AM (#12899239)
Most of the tools listed use PhantomJS or QT core browser as the base. The problem is that PhantomJS doesn't support many new API-s or the rendering is different.

There is also headless chrome browser in development, not sure if there are any prebuilt binaries out there?

Re:A list of headless web browsers by sebcat on Tuesday November 08, 2016 @07:33AM (#12899680)
I've been using chromium-headless for certain automated tasks, and I've been getting a lot better results than from PhantomJS in terms of correctly rendered resources, resource consumption and execution speed. If your business depends on rendering engines and you're using PhantomJS, chromium-headless is probably something you want instead.

I build from chromium src, and my code is more or less an extension with its own BUILD.gn with a deps on //headless. Once you've built the initial tree (took a night for me), builds will be really fast.

Most of the interaction with the browser is by the chrome debugging protocol, as with "normal" chromium. Generally speaking, you want to target that, instead of the internal APIs.

There are some tweaks you need to be aware of. Chromium needs a homedir, so you want to configure that. There's state stored between sessions, so if you want process invocations stateless, consider spending some time hacking or run the process in a fresh namespace/chroot/docker/jail/whatever each time. I had to write my own protocol handler and URLRequestJobs because I render pages from archives on disk and that was the easiest way to get that started at the time.

I don't know if vanilla chromium supports it, but I'm pretty sure I've seen a --headless flag somewhere... If not, headless_shell is pretty easy to build following the official build instructions[1]. I'm running on RHEL/Fedora/CentOS. There's also unofficial images on docker hub if you want to go that route.

[1]: https://chromium.googlesource.com/chromium/src/+/lkgr/headle...

Re:A list of headless web browsers by Flenser on Tuesday November 08, 2016 @07:49AM (#12899780)
Here's the bug to follow if you want to follow progress (the anchor comment in the url is for when screenshot capturing landed)

https://bugs.chromium.org/p/chromium/issues/detail?id=546953...

Re:A list of headless web browsers by boundlessdreamz on Tuesday November 08, 2016 @08:29AM (#12900023)
What about startup time? phantomjs is the only headless browser I have tested which starts up relatively fast.
Re:A list of headless web browsers by sebcat on Friday November 11, 2016 @09:48AM (#12931055)
Can't test now, but around a few tens of milliseconds for about:blank
Re:A list of headless web browsers by spangry on Tuesday November 08, 2016 @12:29PM (#12902155)
Also selenium grid docker containers. Unfortunately their Python documentation isn't the best (though there's some excellent third-party created Python documentation available). To save you the head-scratching I went through, it's basically just:

- Start a 'selenium hub'

- Start up as many firefox/chrome 'node' containers and link them to the hub.

- Point webdriver at the hub port and url.

I will eventually get around to building some Alpine containers for this, one day. I find the official ones a bit 'heavy' given all it really invoves in installing openJDK and running a jar file / browser driver.

Re:A list of headless web browsers by gowan on Tuesday November 08, 2016 @07:32AM (#12899678)
what new apis should phantomjs support?

download support[1] is the only new api in development. it's not tagged for the 2.5 release[2].

[1] https://github.com/ariya/phantomjs/pull/14225 [2] https://github.com/ariya/phantomjs/issues/14458

Re:A list of headless web browsers by nmk on Tuesday November 08, 2016 @10:57AM (#12901230)
FileReader support is not fully implemented (addEventListener is not present). Just ran into this last week.

There has been an open issue for this for three years[1].

[1] https://github.com/ariya/phantomjs/issues/11733

Re:A list of headless web browsers by jordybg on Tuesday November 08, 2016 @06:41AM (#12899428)
Going to ask same question, about headless Chrome, any recent information on that, anyone?
Re:A list of headless web browsers by caleblloyd on Tuesday November 08, 2016 @07:35AM (#12899699)
There is a Google Group for it: https://groups.google.com/a/chromium.org/forum/#!forum/headl...

I check every now and again. I'm super interested in headless PDF generation (using Nigtmare now)

Re:A list of headless web browsers by gowan on Tuesday November 08, 2016 @07:12AM (#12899588)
it is issue 546953[1] in the chromium issue tracker.

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=546953