Live data from Hacker News

Headless mode in Firefox

developer.mozilla.org

51–60 of 191 posts

Re: Headless mode in Firefox

#52

This is very nice. What's the recommended way to run end-to-end tests in headless firefox _and_ headless chrome? Can't wait for a cross-platform headless Edge :-)

I currently have setup two CI jobs running Webdriver.IO with different configurations (different in what browser is used). Locally I just run it on all installed browsers using selenium-assistant - not headless, because I want to see what's going on when running locally.

(And yeah, cross-platform Edge would be nice for being able to test in CI without needing a third party.)

Re: Headless mode in Firefox

#53
post #17
post #6

Can you tell Firefox to print in headless mode? I want to write reports using HTML and JS, but printing is always an issue.

You can generate pdfs with headless Chromium/Chrome pretty easily[1]. chromium-browser --headless --disable-gpu --print-to-pdf=output_file_name.pdf file:///path/to/your/html [1] https://developers.google.com/web/updates/2017/04/headless-c...

If only browsers supported creation of page headers and footers.

Re: Headless mode in Firefox

#54
post #50

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…

> Note you need to be running the beta version of firefox Also note that that's only the case on Windows and OS X (it's already released for Linux), and only as long as Firefox 56 hasn't been released yet :)

:D

Re: Headless mode in Firefox

#55
post #44

Earlier quoted context omitted.

Adding to ^. You don't need to have the Xorg stuff running to run tests.

That's what Xvfb is for. "xvfb-run firefox" and "firefox -headless" should be functionally equivalent. But I would still be interested in performance comparison with numbers.

Doesn't xvfb still just run an Xserver, simply without painting? Or do headless Chrome and Firefox still require an X server running too?

Re: Headless mode in Firefox

#56

since you're setting the environment variable to be headless what happens if you're browsing with Firefox while running your automated process?

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.

Re: Headless mode in Firefox

#58

Earlier quoted context omitted.

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.

Just set your browser to always show punycode. On Firefox, network.IDN_show_punycode = true URLs are no place for unicode characters to hide in. An xn-- prefix is all the warning you need.

Your claims are false for the majority of the world's population (which lives in non-English speaking countries and may well want to visit sites whose names make sense in their own language).

Re: Headless mode in Firefox

#59

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…

Does this offer any real benefit over Xvfb?

Chrome's headless mode uses significantly less memory than using xvfb. I assume FF would have the same benefit. Plus one less moving part, dependency, etc.

Re: Headless mode in Firefox

#60
post #53
post #17

Earlier quoted context omitted.

You can generate pdfs with headless Chromium/Chrome pretty easily[1]. chromium-browser --headless --disable-gpu --print-to-pdf=output_file_name.pdf file:///path/to/your/html [1] https://developers.google.com/web/updates/2017/04/headless-c...

If only browsers supported creation of page headers and footers.

[deleted]
Post reply on HN