Live data from Hacker News

Firefox 56 supports headless mode on Windows

bugzilla.mozilla.org

81–88 of 88 posts

Re: Firefox 56 supports headless mode on Windows

#81

I just finished writing an article that explains how to connect WebDriver to Firefox running in the new headless mode on Windows if anybody's interested: https://intoli.com/blog/running-selenium-with-headless-firef... It should be pretty similar on Linux, and probably macOS when it comes around.

Great article! I'm the product manager for the headless feature, and I'm unsure why `binary.add_command_line_options('-headless')` doesn't work for you, as the flag does work when invoking Firefox directly:

> "c:\Program Files\Nightly\firefox.exe" -headless

(It also works when Firefox is invoked from a Node.js script in a test suite for a Node.js program that drives Firefox.)

Perhaps this is a Selenium issue?

Re: Firefox 56 supports headless mode on Windows

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

(Note: I'm the product manager for the headless browsing feature of Firefox.)

I chose to prioritize WebDriver support because it's a popular way to drive headed Firefox, and I wanted to make it as easy as possible for existing WebDriver users to use headless.

For use cases that are not well-served by WebDriver, I've considered supporting the Chrome DevTools Protocol, as @brendandahl noted, although I haven't yet made a decision to do so.

I'm interested to hear more about the use cases you've considered for which WebDriver is a suboptimal solution. Like @brendandahl, I'm in the Bay Area and would be happy to meet in SF or MV.

Re: Firefox 56 supports headless mode on Windows

#83

I just finished writing an article that explains how to connect WebDriver to Firefox running in the new headless mode on Windows if anybody's interested: https://intoli.com/blog/running-selenium-with-headless-firef... It should be pretty similar on Linux, and probably macOS when it comes around.

Great article! I'm the product manager for the headless feature, and I'm unsure why `binary.add_command_line_options('-headless')` doesn't work for you, as the flag does work when invoking Firefox directly: > "c:\Program Files\Nightly\firefox.exe" -headless (It also works when Firefox is invoked from a Node.js script in a test suite for a Node.js program that drives Firefox.) Perhaps this is a Selenium issue?

Thanks! That was guess as well, since running the command you posted from cmd does work. I dug around selenium's source code a bit, but decided to take the pragmatic path and use the MOZ_HEADLESS environment variable instead.

Re: Firefox 56 supports headless mode on Windows

#84
post #25
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

This got down voted a lot but GTK is really a pretty painful dependency in many situations (especially gtk3) Not that Firefox itself is particularly lightweight.

Well - you will get downvotes for making a technical claim, but not explaining the reason...

Re: Firefox 56 supports headless mode on Windows

#85
post #6

Is there a linux headless mode already? Selenium chrome driver headless is pretty much useless in linux because important methods like `send_keys` need X anyway for keyboard mappings or something like that.

Genuine noob question: could you not use Xvfb?

The ticket is about the Windows version so xvfb is not an option.

Re: Firefox 56 supports headless mode on Windows

#88
post #71
post #28

Earlier quoted context omitted.

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.

I actually have to run it on my desktop due to non-primary use cases.
Post reply on HN