Running Selenium::WebDriver::Firefox inside Xvfb from ruby as NON-root user Running Selenium::WebDriver::Firefox inside Xvfb from ruby as NON-root user selenium selenium

Running Selenium::WebDriver::Firefox inside Xvfb from ruby as NON-root user


  • SOLVED - EDIT * - sorry I couldn't ANSWER the question, but apparently my account is too new to do that just yet.

Solved! Amazing how things like this tend to solve themselves AFTER you've asked the question...

For those wanting to know why, there's a few things I needed to do...

1) Make sure the user in question has a working home directory (www-data didn't by default... its home dir was owned by root)

2) Start Xvfb from command line, and then start firefox from the command line (NOT from within the script) - this will populate the users home folder with the usual .dbus, .gconf etc folders

3) If you get a massive delay and then an error message along the lines of "an error occurred while loading or saving configuration information for firefox-bin", delete the .dbus folder in the users home directory

4) Try #2 again - if you had a config error before, it should now be gone.

5) Try running the script again.

This worked like a charm for me, so if you're having similar issues running Xvfb and watir-webdriver from within a web app, give it a try.

Thanks to all for contributing to what is hands-down the BEST Q&A site on the web... this place has saved my butt more times than I care to mention.

Note: the user originally entered this amended to their question, because they could not figure out how to post it as an answer. That was later edited out of the question by some well meaning person but never added as an answer.


Hi don't know if this link could be a help for you. This helped me a lot. I needed to run watir-webdriver automatically at startup/reboot - it worked for me (read the comments as well).