Fouineur Fouineur - 7 months ago 54
Ruby Question

How to modify the Firefox profile used by Watir-Webdriver

I'm working on web-application automation using Ruby 1.9.3p484 and Watir-webdriver (0.8.0) with Firefox 41.0 for Ubuntu.

I want the browser to not load any images. To do that, I try to change the 'permissions.default.image' firefox parameter to 2.

I have tried the following code:

profile = Selenium::WebDriver::Firefox::Profile.new
profile['permissions.default.image'] = 2
browser = Watir::Browser.new(:firefox, :profile => profile)
browser.goto url


But, the browser keep loading the images. In the about:config page, the 'permissions.default.image' is still set to 1.

Any ideas on what could be wrong?

Answer

I don't know why, but if I use from_name method in Selenium class init, then you code is working perfectly:

profile = Selenium::WebDriver::Firefox::Profile.from_name "default"