Anyone running Firefox in Xvfb on *OSX*?

3,047 views
Skip to first unread message

Lasse Koskela

unread,
Jun 23, 2009, 9:55:53 AM6/23/09
to webdriver
Hi,

I'm trying to set up some WebDriver tests for a build and I'm having
trouble making Firefox 3 on OSX "headless". Xvfb works fine for native
X stuff like xclock but Firefox doesn't seem to do the same.

Basically what I'm experiencing is the exact same situation as someone
blogs about over at http://bit.ly/EcytT

Lasse

Lasse Koskela

unread,
Jun 25, 2009, 1:11:16 AM6/25/09
to webdriver
Hi,

I thought I'd report back what I did with this.

Basically, our webdriver tests were running fine headless on the Linux
server but would pop up windows when run locally and I would've wanted
this to be a decision of the programmer, whether he wants to see those
windows or not. The native Cocoa Firefox doesn't know about X Windows
so I'm guessing that there is no way of coercing it into a virtual
display. There is an X11 Firefox available, however, so I went ahead
and installed that on my Mac. Now, I could tell FirefoxBinary to use
/opt/local/bin/firefox-x11 instead of /Applications/Whatever/firefox
and force it into the virtual display -- if the "DISPLAY" environment
variable or a system property "virtual.display" was set.

To make FirefoxBinary pick up the firefox-x11 I had to move code from
org.openqa.selenium.firefox.internal.Executable over to my codebase.
Essentially I had to add "firefox-x11" to the list of binary names
that Executable#locateFirefoxBinaryFromPlatform would use while
searching for the binary. And "firefox-x11" needed to be first on the
list so that it would get picked up over the native Firefox when
DISPLAY was set.

Lasse

Simon Stewart

unread,
Jun 25, 2009, 3:02:47 AM6/25/09
to webd...@googlegroups.com
Hi Lasse,

Thank you for letting us know how you got on.

I'm a little surprised that you had to move code around. Does this work for you?

File x11Firefox =
new File("/opt/local/bin/firefox-x11");
FirefoxBinary binary =
new FirefoxBinary(x11Firefox);
WebDriver driver =
new FirefoxDriver(binary, null);

If that's a little long-winded for you (and it may well be :) it's
also possible to set the system property "webdriver.firefox.bin":

System.setProperty("webdriver.firefox.bin",
"/opt/local/bin/firefox-x11");
new FirefoxDriver();

In both cases, the binary needs to be the full path to the program to
execute (including the program name) On Windows, this would mean that
the name ends with ".exe". Essentially, we "exec" this file to start
Firefox.

Regards,

Simon

ash

unread,
Mar 18, 2013, 10:49:51 AM3/18/13
to webd...@googlegroups.com
I'm not sure if you mean OSX as linux servers but here's what i got which runs fine in linux running on Xfvb via selenium grid.

                        FirefoxBinary binary = new FirefoxBinary(new File("/home/<path>/firefox.10.0/firefox"));
                        FirefoxProfile profile = new FirefoxProfile();
                        profile.setEnableNativeEvents(true);
                        //profile.setAssumeUntrustedCertificateIssuer(true);
                        Driver = new FirefoxDriver(binary, profile);
                        System.out.println("Starting firefox version 10.0 in linux");

Let me know if it works.

Hope that helps!




On Fri, Mar 15, 2013 at 3:15 PM, Stephen Mathieson <sma...@gmail.com> wrote:
I know this is a *very* old thread, but have you had any luck?  

--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



 
Reply all
Reply to author
Forward
0 new messages