Live data from Hacker News

Headless mode in Firefox

developer.mozilla.org

131–140 of 191 posts

Re: Headless mode in Firefox

#131
post #100

Can someone do an ELI5 on why headless browsers are useful? I've use them before to make screenshots of webpages, and I have noticed that many NPM packages come (or came) with PhantomJS as a dependency, but I have no idea why one would need that.

Automated integration/regression tests is a pretty big use case. You spin up a copy of your server, point the headless browser at it, run some JavaScript to simulate some user interactions, and verify the page contains the right strings / screenshot doesn't deviate too much from a golden image. I guess the ELI5 way of saying that would be: "Making sure your website still works." People also headless browsers for cont…

So an ELI5 of everything you said would be:

Putting the website through user actions in a firefox browser and recording/capturing/documenting the results headlessly. Headless version allows you to go through hundreds of results in the background.

Re: Headless mode in Firefox

#132

Earlier quoted context omitted.

If you need professional typesetting from HTML+CSS, Prince XML is still king, I'm pretty sure. It can be invoked & run heedlessly. It also supports page-oriented CSS declarations and variables, like headers, footers, page numbers, etc.

What are the features that make Prince XML better than headless chrome? Prince XML is not open source or cheap.

Simply put, it's designed to make PDF output and provides a lot of quality-of-life tooling around that. Better support for CSS paged media and non-HTML XML input, better handling of page-spanning tables, shims for things missing from paged media (like hyphenation and ligature controls, PDF-specific objects to modify output with Javascript, Javascript embeds into PDF output), better out-of-the-box styles, better documentation and support, and more predictable output and better debugging tools.

Browsers are catching up on paged media options, but they're not all the way there yet. The rest of the stuff Prince does is not (and arguably shouldn't be) in the scope of headless Chrome.

There was a brief moment where headless Chrome supported flexbox in print before Prince did, but that was fixed a month or so ago in Prince dev and should land in production soon if it hasn't already.

Re: Headless mode in Firefox

#133
post #15
post #3

As a UI designer, I dream of strike headless strike chromeless browsers, where the UI appears when you need it, intuitively, even when NOT in full screen. The top bar simply takes too much unnecessary space. If there's any dev that wants to collaborate on this, let me know :)

A small nomenclature clarification seems to be in order: "Headless" means without output. It is often used to describe servers without any attached monitors (the monitor would be the head that it is missing), but can similarly be used to describe browsers that do not even create a window on your desktop. It simply runs as a service that can be scripted. What you are looking for, I would rather call "chromeless". The…

> What you are looking for, I would rather call "chromeless". The browser is there, but it has no visible UI-components outside of the webpage.

Why "chromless" and not just "Full screen"? The latter is what that mode has been known by for decades? Or is it a subtle distinction that "Full screen" mode can show the location bar by moving the mouse to that edge of the screen (at least in Firefox 55), while "chromless" never lets you see the location bar?

Re: Headless mode in Firefox

#134

Earlier quoted context omitted.

Wow - thanks for posting that: could come in handy on the project I'm currently working on!

We're using Chrome Headless inside Docker to produce thousands of PDF reports from an Angular/D3 web app. It works very well, but there are some gotchas with regard to the Chrome Remoting Interface.

Yeah, D3 is what we're working with as well; also need to be able to embed the charts in Powerpoint, but that'll be a different story. All fun and games.

Re: Headless mode in Firefox

#135

For all of you old fogies working on angular 1 apps and are running browser tests with karma you can run your tests in firefox with headless mode with a customer launcher. Add the snippet below to your karma conf ``` browsers: ['FirefoxHeadless'], customLaunchers: { FirefoxHeadless: { base: 'Firefox', flags: [ '-headless', ], }, }, ``` Note you need to be running the beta version of firefox, I needed to download it f…

I use karma. Do only Angular 1 folks use it?

What does everyone else use for browser tests?

Re: Headless mode in Firefox

#136

Earlier quoted context omitted.

F11?

F11 is full screen, not headless. Headless means you can't see the browser or the website content, it's built for scripting purposes (automated web testing and web scraping). The only time you can see the content is if your script requests a screen capture.

I know what headless means, but if fairpx is really referring to headless (he seems to have changed his post) then I have no idea what this means:

> where the UI appears when you need it, intuitively, even when NOT in full screen

or how it relates to a headless browser.

Re: Headless mode in Firefox

#138
Tools like headless browsers might turn into the "perl" of this generation. :)

Years ago I could always find a way to make Perl do whatever I wanted. It was usually "wrong" to fire up an entire interpreter compared to using faster, less flexible tools but it got the job done. Now I imagine people thinking, "the browser will do this", especially if they can grab screenshots or other local data files.

Re: Headless mode in Firefox

#139

Does anyone know if there is a way to control the window size? If there is does it also modify screen.availHeight properties and other give aways that you have modified the window size.

Looks like it's controlled through webdriver..

I'm guessing you can lookup the webdriver spec to see what you can do...

Post reply on HN