Skip to content

Firefox Support

j0ni edited this page Mar 12, 2013 · 6 revisions

Support for Firefox currently exceeds that for all other browsers, most notably via support for customizable Firefox profiles. I've included support for several of these advanced featues in the clj-webdriver.firefox namespace.

(use 'clj-webdriver.core)
(require '[clj-webdriver.firefox :as ff])

(def b (new-driver {:browser :firefox
                    :profile (doto (ff/new-profile)
                               ;; Enable Firebug
                               (ff/enable-extension "/path/to/extensions/firebug.xpi")

                               ;; Auto-download certain file types to a specific folder
                               (ff/set-preferences { "C:/Users/semperos/Desktop",
                                                    :browser.helperApps.neverAsk.saveToDisk "application/pdf"

                               ;; To Disable opening "First-run" Page in Browser for firebug pass the currentVersion of firebug
                                                    :extensions.firebug.currentVersion "1.10"

                               ;; Add a proxy server
                                                    :network.proxy.http "localhost"
                                                    :network.proxy.http_port 8080
                                                    :network.proxy.type 1}))}))

The enable-extension function can also accept a keyword argument like :firebug. In this situation, clj-webdriver assumes you have a system variable called FIREFOX_EXTENSION_FIREBUG defined that points to the absolute path of the *.xpi file for that extension. It then uses that to enable the extension, so you only have to have that path defined once at the system level.

Something went wrong with that request. Please try again.