Last active
July 26, 2016 08:58
-
-
Save bogdanRada/4285654 to your computer and use it in GitHub Desktop.
Capybara add Firebug to Selenium test-- Rails+Rspec.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for more preferences visit this page | |
#https://getfirebug.com/wiki/index.php/Firebug_Preferences | |
require 'selenium/webdriver' | |
ORIGINAL_FIREBUG_PATH = File.expand_path(File.join(File.dirname(__FILE__),"firebug-2.0.16-fx.xpi")) | |
ORIGINAL_FIREBUG_URL = "https://getfirebug.com/releases/firebug/1.13/firebug-1.13.0a9.xpi"; | |
Capybara.register_driver :selenium do |app| | |
profile = Selenium::WebDriver::Firefox::Profile.new | |
profile.add_extension ORIGINAL_FIREBUG_PATH | |
# Prevent "Welcome!" tab | |
profile["extensions.firebug.currentVersion"] = "1.13" | |
# Enable for all sites. | |
profile["extensions.firebug.allPagesActivation"] = "on" | |
# prevent firebug open new tab | |
profile["extensions.firebug.showFirstRunPage"] = false; | |
# Enable all features. | |
['console', 'net', 'script', 'cookies'].each do |feature| | |
profile["extensions.firebug.#{feature}.enableSites"] = true | |
end | |
# Opened by default.(if you want to be closed than change this to 3) | |
profile["extensions.firebug.previousPlacement"] = 1 | |
#show javascript errors | |
profile["extensions.firebug.showJSErrors"] = true | |
# show AJAX requests | |
profile["extensions.firebug.showXMLHttpRequests"] =true | |
#show network errors | |
profile["extensions.firebug.showNetworkErrors"] = true | |
# stack trace | |
profile["extensions.firebug.showStackTrace"] = true | |
# default pane to see | |
profile["extensions.firebug.defaultPanelName"] = "console" | |
Capybara::Selenium::Driver.new app, :profile => profile | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment