Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

running selenium tests with Firefox headless on osx

520 views
Skip to first unread message

William Kahn-Greene

unread,
Jan 5, 2017, 3:44:38 PM1/5/17
to dev-webdev
Hi!

When running selenium tests with the Firefox webdriver, it opens and
closes the window like a million times and prevents you from doing any
useful work for the duration of the test run. It's pretty irksome and
a time waste.

On Linux, we use xvfb to run selenium tests with the Firefox
webdriver. It's fairly straight-forward to set up. Works fine.

However, it seems overly complicated to set up xvfb on OSX to do the same thing.

Given that, what do all you OSX users do to run selenium tests with
the Firefox webdriver headless?

/will

Robert Helmer

unread,
Jan 5, 2017, 4:41:19 PM1/5/17
to William Kahn-Greene, dev-webdev
My understanding (which is a few years old and may be wrong now!) is
that the Mac window service needs to be attached to a real graphics
device, and processes that connect to it need to be running locally.

Building Firefox for X11 for Darwin/Mach-O is apparently possible, but
you're not testing the same thing at all. You might as well just test
on Linux.

Mozilla does perf tests for Firefox by attaching a graphics dongle
that pretends to be a monitor (to be able to set the correct
resolution), and auto-logging into the desktop.

It *would* be possible on all platforms if Firefox had built-in
support for running in headless mode:
https://bugzilla.mozilla.org/show_bug.cgi?id=446591

Chrome shipped a headless mode in the last year or so:
https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
> _______________________________________________
> dev-webdev mailing list
> dev-w...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-webdev

David Burns

unread,
Jan 5, 2017, 4:49:26 PM1/5/17
to William Kahn-Greene, dev-webdev
WebDriver does that because there are events that only fire when the
browser has focus.

I know that Myk is working on a headless Firefox for 2017+.

As for running headless in OSX, I think you would be fine with getting your
tests to run in a linux container unless there are specific features that
Firefox on OSX has that you want to test. If there is something specific to
OSX and Firefox then unfortunately it's going to continue to steal focus
(sorry).


David

Paul McLanahan

unread,
Jan 5, 2017, 4:59:12 PM1/5/17
to dev-webdev
I've not used this personally, but it looks like using docker-selenium[0] and Docker for $PLATFORM[1] should make this better and portable. I'd be interested to hear how it goes if you try this.

- pmac

[0] https://github.com/SeleniumHQ/docker-selenium
[1] https://www.docker.com/products/overview#/install_the_platform
0 new messages