Hemant
Hemant

Reputation: 11

Firefox webdriver-Changing the default download location at runtime

How do I set a default download location for Firefox at runtime. Is there any way to prevent the folder selection popup from coming?

Upvotes: 1

Views: 1239

Answers (1)

cakes88
cakes88

Reputation: 1917

I would follow the code found on this blog

Something like:

profile = webdriver.FirefoxProfile()

profile.set_preference("browser.download.folderList",2)
profile.set_preference("browser.download.manager.showWhenStarting",False)
profile.set_preference("browser.download.dir",getcwd())
profile.set_preference("browser.helperApps.neverAsk.saveToDisk","text/csv")

browser = webdriver.Firefox(firefox_profile=profile)

Hope that helps.

Upvotes: 1

Related Questions