Setting path to firefox binary on windows with selenium webdriver

To set the custom path to Firefox you need to use FirefoxBinary:

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary('F:\FirefoxPortable\Firefox.exe')
driver = webdriver.Firefox(firefox_binary=binary)

Or, alternatively, add F:\FirefoxPortable to the PATH environment variable and fire up Firefox in a usual way:

driver = webdriver.Firefox()

Leave a Comment