Live data from Hacker News

Headless mode in Firefox

developer.mozilla.org

91–100 of 191 posts

Re: Headless mode in Firefox

#92
post #61

Now if only Firefox also implemented the Chrome Remote Debugging Protocol... https://chromedevtools.github.io/debugger-protocol-viewer/to...

Firefox does have their own, documented and seemingly stable remote debugging protocol. I haven't used it recently, but there is the Valence project (https://github.com/mozilla/valence) which provides adapters for their debugging tools for other protocols, namely Chrome's remote debugger. In the past, I have used this to debug Chrome with firefox's devtools. Maybe it works for your needs?

Re: Headless mode in Firefox

#93

Earlier quoted context omitted.

Wait, why did you need to use XVFB with PhantomJS? Isn't Phantom headless as is?

Still requires a X server, which docker containers won't necessarily have.

Only versions 1.4 and below. Versions 1.5 and above do not require an X server. Version 1.5 has been available for 5+ years: https://ariya.io/2012/03/pure-headless-phantomjs-no-x11-or-x...

Re: Headless mode in Firefox

#94

Earlier quoted context omitted.

No, this has been in the works for a while https://bugzilla.mozilla.org/show_bug.cgi?id=1338004 So not in reaction to Chrome. In fact, the first attempt for this was almost a decade ago ( https://bugzilla.mozilla.org/show_bug.cgi?id=446591 )

Thanks for the info, that's good news.

Or you could look at as really bad news if it takes a decade to implement this.

Re: Headless mode in Firefox

#96
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.

Re: Headless mode in Firefox

#97
post #56

Earlier quoted context omitted.

You don't need to set all your environment variables in your bashrc, if that's not obvious. They're not global state. You can change them on a per-terminal basis, and that only effects the environment of that one terminal. Firefox does some weird stuff with multiprocessing, where if you run the firefox command twice you only get one process. I don't know how that would effect things, but I imagine just setting the en…

Additionally, it's also possible to turn it on using the CLI flag `--headless`, if setting env vars is a concern.

Oh, and additionally: passing options with a double dash doesn't work on Windows, so use `-headless` to be sure.

Re: Headless mode in Firefox

#99
post #23

Earlier quoted context omitted.

No it isn't, the URL is unreliable source of truth with Unicode spoofing attacks and things like that. Safari only shows the domain at this point; the URL is an unimportant implementation detail.

It would be cool if browsers could highlight URLs that contain the kind of characters which are commonly used to spoof, though I suppose it would lead people to a false sense of security.

Cyrillic Er looks exactly like Latin P, so writing apple with Cyrillic "Er"s would likely be spoofing. But if you highlight all instances of Cyrillic Er, you also have to highlight every P, since the URL of a Russian bank spelt with Cyrillic Er could be spoofed with Latin P.

In the end, you would just highlight nearly everything. A more useful approach would be to highlight when you switch script inside a domain name. That seems to be what firefox does for non-whitelisted domains (with some more rules to allow eg www.stマイクロ.jp (ST Microelectronics in japanese))

Re: Headless mode in Firefox

#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 content generation inside larger systems. (I saw one team make videos by creating CSS animations, and then capturing screenshots from the headless browser at 30 fps.)

Post reply on HN