Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable add-ons in firefox when using selenium

I'm using Capybara selenium in my Rails project (on an Ubuntu 10.04 system) and I've just upgraded firefox now when I'm running my tests firefox loads but it now has all the add-ons installed and it waits until I set each one up for the first time.

Is there a way to disable all these add-ons when starting selenium?

OR

Is there a way to setup all my add-ons and save the settings so that it doesn't prompt me everytime the tests are ran?

Update

If I change it over to use chrome it works fine with that.

 Capybara.register_driver :selenium do |app|
   Capybara::Selenium::Driver.new(app, :browser => :chrome)
 end

 Capybara.javascript_driver = :selenium

I would like to do the tests with firefox though. I've setup a 'test' profile under firefox and tried using it with the following:

Capybara.register_driver :selenium_firefox_custom do |app|
  Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => "test")
end

Capybara.default_driver = :selenium_firefox_custom

Which didn't work, it still tried to load my default profile.

I'm using the git version of capybara;

capybara (1.1.2)
  mime-types (>= 1.16)
  nokogiri (>= 1.3.3)
  rack (>= 1.0.0)
  rack-test (>= 0.5.4)
  selenium-webdriver (~> 2.0)
  xpath (~> 0.1.4)

I've also tried using Capybara.javascript_driver = :selenium_firefox_custom

like image 466
map7 Avatar asked May 14 '12 06:05

map7


People also ask

How do I Turn Off Firefox add ons?

Firefox Click the Firefox Menu button (☰) and select "Add-ons.". Click the "Extensions" tab on the left. Click the "Disable" button next to the add-on you want to disable. Click "Remove" to uninstall an add-on completely. Reset Firefox to remove all of your installed extensions.

How do I enable or disable Firefox extensions?

Click the Firefox menu icon in the upper right of the browser toolbar. From the left navigation pane, choose Extensions. Alternatively, if you wish to disable all extensions as a troubleshooting measure, you may choose to Create a new Mozilla Firefox Profile Click the Firefox menu icon in the upper right of the browser toolbar.

How do I disable add-ons in chrome?

The toggle switch turns grey when the extension is disabled. To uninstall an extension, click the Remove button at the bottom of the box that lists the extension you want to uninstall. Reset Chrome to disable all add-ons at once. If you are overloaded with add-ons, resetting Chrome will disable all of them.

How do I Turn Off Firefox on Windows XP?

This also keeps your Firefox running smoothly. Click on the Firefox button (Tools in Windows XP) and then Add-ons. In the Add-ons Manager tab, choose Extensions. Select the add-on that you want to disable or remove. To turn it off, select Disable. To delete it altogether, select Remove.


Video Answer


2 Answers

If you didn't want to create a profile that you have to maintain (eg: checking in to source control, etc), you could create the profile on the fly as follows:

Capybara.register_driver :selenium_firefox do |app|
  profile = Selenium::WebDriver::Firefox::Profile.new
  profile["extensions.update.enabled"] = false
  profile["app.update.enabled"] = false
  profile["app.update.auto"] = false
  Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
end

Capybara.default_driver = :selenium_firefox

That will create a profile on the fly that won't update the browser version or the extensions. Hope that helps!

like image 122
Nat Ritmeyer Avatar answered Oct 25 '22 11:10

Nat Ritmeyer


Try using a custom profile, and naming it however you like:

Capybara.register_driver :selenium_firefox_custom do |app|
  Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => "custom")
end

Capybara.default_driver = :selenium_firefox_custom

Depending on the version you're using the API may have changed, but pretty much this is what you have to do.

like image 28
Pedro Nascimento Avatar answered Oct 25 '22 11:10

Pedro Nascimento