Fouineur Fouineur - 1 year ago 161
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 =
profile['permissions.default.image'] = 2
browser =, :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 Source

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"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download