Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install Firebug for Capybara
# UPDATE: You are probably better off using jfirebaugh's gem.
# See
# Set up Capybara to install Firebug in the default session.
# Download firebug.xpi from and check it in.
# Set FirebugFix::ORIGINAL_XPI_PATH to its location.
require 'selenium/webdriver'
class FirebugFix
ORIGINAL_XPI_PATH = File.join(Rails.root, "features/support/firebug.xpi")
# Rejigger Firebug so the welcome page doesn't come up on launch
def self.generate_patched_xpi
tmp_name = "firebugfix-#{}"
tmp_dir = "/tmp/#{tmp_name}"
xpi_path = "/tmp/#{tmp_name}.xpi"
script = <<-END
mkdir #{tmp_dir}
cd #{tmp_dir}
sed -i '' -e 's/currentVersion", ""/currentVersion", "99"/' defaults/preferences/firebug.js
zip -r #{xpi_path} *
raise "Failed to generate firebug.xpi" if $? != 0
Capybara.register_driver :selenium do |app|
patched_xpi = FirebugFix.generate_patched_xpi
profile =
profile.add_extension patched_xpi app, :profile => profile
# This code is dedicated to the public domain using a CC0 license.

This comment has been minimized.

Copy link

@jfirebaugh jfirebaugh commented Mar 6, 2011

Thanks for this. I figured out how to set up the profile in a way that doesn't require repackaging firebug, and released it as a gem:


This comment has been minimized.

Copy link
Owner Author

@wrs wrs commented Mar 10, 2011

Thanks John! I've switched to your gem and it's working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.