Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Using Firebug with WebDriver in Capybara/Cucumber

Mike Gehard
Tuesday, September 21, 2010

Ever wanted to be able to debug an HTML page using the power of Firebug while running Cucumber/Capybara features/steps?

Follow these simple steps and you can get it to work:

1) Create a new “WebDriver” Firefox profile using the instructions found here

2) Fire up Firefox using the newly created profile and install/configure Firebug the way you want it. See instructions above.

3) Run your Cucumber/Capybara steps and pause the feature using a sleep() statement long enough for you to poke around in the page with Firebug.

**Note this has been proven to work on OS X, your mileage on other OS’s may be limited.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

2 Comments

  1. Will Leinweber says:

    Better than a `sleep`, a `debugger` so you don’t have to guess at a long sleep time, and you get to play around with the system if you need to.

    September 21, 2010 at 9:37 am

  2. Jari Bakken says:

    Hi,

    This method relies on an implementation detail in WebDriver (the fact that the anonymous profile created is named “WebDriver”) which might change in the future.

    There’s two ways to do what you want using WebDriver APIs:

    1. Use Profile#add_extension. This lets you programatically add an .xpi to the profile used by WebDriver. Here’s an example:

    http://gist.github.com/590509

    2. Use the same approach as above, but tell WebDriver explicitly that it should use the named profile as a template, i.e. if the profile was named “capybara”:

    Selenium::WebDriver.for :firefox, :profile => “capybara”

    Hooking this into Capybara should be simple using the new API to configure drivers:

    http://github.com/jnicklas/capybara/commit/d536eea864a6ed7e9e0032ec9d61edaadba6a375

    September 21, 2010 at 1:56 pm

Add New Comment Cancel reply

Your email address will not be published.

Mike Gehard

Mike Gehard
Boulder

Recent Posts

  • Using Jasmine to test CoffeeScript in a Rails 3.1 App
  • Waiting for jQuery Ajax calls to finish in Cucumber
  • Mocking Fog when using it with Carrierwave
Subscribe to Mike's Feed

Author Topics

coffeescript (1)
rails3 (10)
capybara (6)
cucumber (12)
javascript (2)
jquery (1)
webdriver (5)
carrierwave (1)
fog (1)
s3 (2)
testing (1)
rspec2 (3)
omniauth (1)
ruby (5)
devise (1)
aruba (2)
generators (2)
solr (1)
sunspot (1)
concerns (1)
mixins (1)
resque (1)
thin (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >