Setting path to firefox binary on windows with selenium webdriver Setting path to firefox binary on windows with selenium webdriver selenium selenium

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 FirefoxBinarybinary = 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()


By default selenium will look into the path - C:\Program Files (x86)\Mozilla Firefox\

Please install Firefox using the link - http://filehippo.com/download_firefox/67599/ and try

For this, you no need to give the binary.

If you want to install Firefox in custom location then give the directory as your wish when it pops up for location. If you installed in custom location then we need to mention Firefox binary location in the code as below

from selenium import webdriverfrom selenium.webdriver.firefox.firefox_binary import FirefoxBinarybinary = FirefoxBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe")fp = webdriver.FirefoxProfile()driver = webdriver.Firefox(firefox_binary=binary, firefox_profile=fp)


If you for example downloaded the chrome driver already, you can just specify the path to it like that:

from selenium import webdriverdriver = webdriver.Chrome(r'D:\\chromedriver.exe')