Search code examples
seleniumcucumbercapybaraheadless

How to replace Iceweasel with Firefox for headless Cucumber/Capybara tests?


I am running a set of Cucumber/Capybara tests with Selenium, using the headless gem in a Debian VM. For some reasons that I won't go into here, I would like to replace Iceweasel with a real Firefox installation.

So I uninstalled iceweasel, and the followed these instructions: http://www.fandigital.com/2012/09/install-real-firefox-in-debian.html

Download Firefox

Download latest version of the original Mozilla Firefox for Linux from the official Mozilla website here, and put it in the Downloads folder within your Home directory (/home/YourUserName/Downloads).

Install Firefox

Copy and extract Firefox archive Open Terminal, and change directory (cd) to the Downloads folder:

cd /Downloads

Then run the following commands (one-by-one):

  • sudo cp firefox-*.tar.bz2 /opt
  • cd /opt
  • sudo tar -xvf firefox-*.tar.bz2
  • sudo rm firefox-*.tar.bz2

Create symbolic link to firefox binary

Backup (move) any existing firefox bin:

sudo mv /usr/bin/firefox /usr/bin/firefox.backup

Create symbolic link to the real firefox binary:

sudo ln -s /opt/firefox/firefox /usr/bin/firefox

As soon as I start my tests, I unfortunately run into the following error: unable to obtain stable firefox connection in 60 seconds. I have not been able to solve this problem. Any advice on how to proceed?


Solution

  • I ended up using PhantomJS and am very pleased with it. Much faster than the previous setup.