Live data from Hacker News

Firefox 56 supports headless mode on Windows

bugzilla.mozilla.org

71–80 of 88 posts

Re: Firefox 56 supports headless mode on Windows

#71
post #28
post #22

"headless" Poke me when there are no X11/Qt/GTK/whatever dependencies at all - that is headless. https://packages.debian.org/stretch/firefox-esr

If your running this on a server sure great. On desktop that is next to pointless due to the need for those dependencies for everything besides cure apps.

>If your running this on a server sure great.

Which is certainly the obvious primary use case for headless browsers.

Re: Firefox 56 supports headless mode on Windows

#72
post #36

It's not very clear how to actually use this in a test environment like Selenium etc. At least with headless Chrome there are libraries now to drive it via the remote debug protocol like https://github.com/LucianoGanga/simple-headless-chrome This feels a little nicer than Selenium as it's one less layer of abstraction. EDIT: guess from other comments WebDriver is the right method to access.

FWIW, from the Chome side, we think there's more power via the protocol rather than WebDriver.

On the Firefox side, we are considering supporting the protocol or a subset of it. It seems many people have had lots of trouble with WebDriver/Selenium in the past and are hesitant to use it. However, it is nice that WebDriver has a W3C standard which could provide a nice path forward for headless cross browser use. This would probably require browser vendors to make it a first class citizen and work out some the kinks of the spec though.

BTW, I'm in Mozilla San Francisco office, so I'd be happy to chat about the headless cross browser future if anyone from the headless Chrome team is around.

Re: Firefox 56 supports headless mode on Windows

#73
post #36

It's not very clear how to actually use this in a test environment like Selenium etc. At least with headless Chrome there are libraries now to drive it via the remote debug protocol like https://github.com/LucianoGanga/simple-headless-chrome This feels a little nicer than Selenium as it's one less layer of abstraction. EDIT: guess from other comments WebDriver is the right method to access.

FWIW, from the Chome side, we think there's more power via the protocol rather than WebDriver.

Well, yes, a low level protocol is going to have at least the same features as a higher level protocol implemented in terms of it. However I think you should mention the significant disadvantages of using a nonstandard API:

* Doesn't generalise to driving other browsers. Using a standardised API gives you the possibility to run your automation against any top tier browser. If you are testing a website this ought to be a top consideration.

* Uncertain compatibilty story. I assume that the devtools protocol can change at the whim of the Chrome team. Using something standardised means that your tests and client are more likely to continue working.

* More limited selection of clients. WebDriver in particular has a large number of production-grade clients that are actively maintained.

I'm not claiming that WebDriver is perfect; certainly if I designed it from scratch it would look very different. And yes, there is a period of churn as it moves toward being a standard. But I think the advantages of cross-browser support are a compelling reason for it to be the default tool for remote automation tasks that are within the scope of its featureset. By all means, if you have something that cannot be done with a standardized technology look at the proprietary solutions. But I don't think it should be your first pot of call.

Re: Firefox 56 supports headless mode on Windows

#75
post #23

Earlier quoted context omitted.

A headless browser is a web browser without a GUI. Extremely useful in web testing/scrapping.

Blog / forum "SEO" spam bots will also be a big use case.

Sure but they most likely already run off xvfb.

Re: Firefox 56 supports headless mode on Windows

#77

What are the biggest challenges when implementing headless mode? I'm asking cause this feature took some time to be delivered both in Firefox and Chrome and I always assumed that it should be 'pretty' straightforward to implement. Is it that both engines were coupled with GUI libs?

Patch author here. bzbarsky's comment covered most of it. It hasn't turned out to be that difficult. On linux, it was mostly playing whack-a-mole of avoiding calls in to gtk/x11 and then creating headless implementations of the platform specific code.

One slight complication of headless has been wiring up the headless "widgets" (in Firefox, we refer to most of the platform specific code as widgets e.g. there's gtk widgets, cocoa widgets, windows widgets). Usually the widget type is defined statically at build time, but in the case of headless we wanted Firefox to either use the headless widgets or the platform specific widgets at runtime. Luckily, some of the work on multi-process Firefox work also added another type of widget and made it much easier to support multiple types of widgets.

Overall, the hardest part has been trying to replicate all the events that would normally be triggered by the platform gui code. I've also found that these events and order can vary per platform which makes it hard to do in a non-platform specific way. We're still working out some issues here.

Re: Firefox 56 supports headless mode on Windows

#79
post #73

Earlier quoted context omitted.

FWIW, from the Chome side, we think there's more power via the protocol rather than WebDriver.

Well, yes, a low level protocol is going to have at least the same features as a higher level protocol implemented in terms of it. However I think you should mention the significant disadvantages of using a nonstandard API: * Doesn't generalise to driving other browsers. Using a standardised API gives you the possibility to run your automation against any top tier browser. If you are testing a website this ought to b…

All of these look like advantages if you're building a monopoly and have a contempt for anything that slows that down.

Re: Firefox 56 supports headless mode on Windows

#80
post #32

Earlier quoted context omitted.

Upvote the bug! https://bugzilla.mozilla.org/show_bug.cgi?id=1372998 I doubt it'll happen anytime too soon, but Mozilla should see the community interest.

As minor counterpoint: Firefox is not strictly speaking developed "by Mozilla" but by the community. Mozilla's the curator, and has a fair bit of staff also working on it, but vast swathes of the codebase are community contributions. If you need FF to do a thing, and you think you have good enough ideas to contribute the solution there, then rather than upvoting a bug, or bumping it to ask what's happening, be the pe…

Of course, but bug upvotes don't hurt that cause, either. I have a few reasons that I work on open source projects. First, to fix a bug or add a feature that affects me directly. Second, to learn something new. If I'm just doing the latter, I'd prefer to tackle a bug with more interest/votes, to help others out while I'm at it and increase the odds of finding a willing reviewer.
Post reply on HN