Sha256: 973da045ad3de70e14e41a1c0905e19842dc5b6c5f44becfae457c5ecdc86c33

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

require 'selenium/webdriver'

class Selenium::WebDriver::Firefox::Profile
  def self.firebug_version
    @firebug_version ||= '1.6.2'
  end

  def self.firebug_version=(version)
    @firebug_version = version
  end

  def enable_firebug(version = nil)
    version ||= Selenium::WebDriver::Firefox::Profile.firebug_version
    add_extension(File.expand_path("../firebug-#{version}.xpi", __FILE__))

    # Prevent "Welcome!" tab
    self["extensions.firebug.currentVersion"] = "999"

    # Enable for all sites.
    self["extensions.firebug.allPagesActivation"] = "on"

    # Enable all features.
    ['console', 'net', 'script'].each do |feature|
      self["extensions.firebug.#{feature}.enableSites"] = true
    end

    # Closed by default.
    self["extensions.firebug.previousPlacement"] = 3
  end
end

Capybara.register_driver :selenium_with_firebug do |app|
  profile = Selenium::WebDriver::Firefox::Profile.new
  profile.enable_firebug
  Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
end

if defined?(Cucumber::RbSupport)
  Before '@firebug' do
    Capybara.current_driver = :selenium_with_firebug
  end

  Then /^stop and let me debug$/ do
    require 'ruby-debug'
    debugger
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara-firebug-0.0.6 lib/capybara/firebug.rb