Firefox

It just works™

Firefox is supported through a JavaScript driver, therefore ‘it just works™’ on all platforms.

b = Watir::Browser.new :firefox

Firefox Profiles

By default, the Firefox driver creates a new Firefox profile for each test run, which is the recommended action.

You can specify an existing profile to use, such as your ‘default’ profile:

b = Watir::Browser.new :firefox, :profile => 'default'

You can also create a new Firefox profile each test run using any of the options that you can configure in the about:config pane of Firefox

For example:

profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.dir'] = "/tmp/webdriver-downloads"
profile['browser.download.folderList'] = 2
profile['browser.helperApps.neverAsk.saveToDisk'] = "application/pdf"

b = Watir::Browser.new :firefox, :profile => profile

Native Events on Microsoft Windows

Native events are enabled on Windows by default and intend to provide a lower level interaction between webdriver and the operating system. However, these seem to cause problems in certain conditions. These can be easily disabled by setting the option on the Firefox profile:

profile = Selenium::WebDriver::Firefox::Profile.new
profile.native_events = false
Watir::Browser.new :firefox, :profile => profile

Specifying a proxy to use with Firefox

profile = Selenium::WebDriver::Firefox::Profile.new
profile.proxy = Selenium::WebDriver::Proxy.new :http => 'myproxy.com:8080:, :ssl => 'myproxy.com:8080'
b = Watir::Browser.new :firefox, :profile => profile

Using Firebug with Watir-WebDriver

First download the Firebug xpi file, then use the following code:

profile = Selenium::WebDriver::Firefox::Profile.new
profile.add_extension "../path/to/firebug.xpi"
b = Watir::Browser.new :firefox, :profile => profile