Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I’ve got Dreamhost shared hosting, and I’m trying to run Firefox 3.0 on it headlessly for use with Selenium.

When I try to run it (~/local/bin/firefox/firefox), I get the following error message:

error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

How can I run Firefox on Linux without requiring this shared object file?

share|improve this question
add comment

3 Answers

up vote 6 down vote accepted

You can't run Firefox without all the Gtk libraries it requires, but that's easily solved by installing the libraries. Normally you would install Firefox through a package management system and this would pull in all the required libraries.

To run Firefox normally, you need an X server (that's the part that displays the windows and their contents, as opposed to things like Gtk which are libraries that the applicattion uses to build the content). That's something you wouldn't usually run on a server. There are a very few things you can do in Firefox without an X server, I don't know if Selenium is one of them.

To run Firefox on your server, run a “virtual” X server. A simple one is Xvfb (virtual framebuffer X server). It's in the X.org server distribution. Sample usage:

Xvfb :19 -screen 0 1024x768x16 &
export DISPLAY=:19
firefox &
share|improve this answer
    
Excellent, cheers Gilles, that’s done it. I also found these articles helpful for getting Xvfb running: alittlemadness.com/2008/03/05/running-selenium-headless, and blog.kabisa.nl/2010/05/24/… –  Paul D. Waite Mar 14 '11 at 8:44
add comment

You can't; it is linked with the X and Gtk+ client libraries, and I don't think it's even possible to build it without them.

share|improve this answer
add comment

Since Selenium is a GUI testing tool, I would find it hard to believe that it can work without X.

So my best guess is that your headless server requires an X installation such as that suggested by Gilles. There are a number of similar alternatives.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.