Set download directory using selenium (and python)

Viewed 5733

I was originally going to ask this question just for Safari. However, I've yet to find the answer for Edge, Opera, Safari and IE (although I think it might not be possible for the latter). Since there seems to be no goto place for this simple question I figured this could all be put into one post.

Questions: Is this possible for Edge, Opera, Safari and IE? If so, how?

Here is the code for Chrome and Firefox for reference

# Chrome
options = selenium.webdriver.ChromeOptions()
options.add_experimental_option("prefs", {"download.default_directory": download_directory})
driver = selenium.webdriver.Chrome(chrome_options=options)

# Firefox
profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.dir", download_directory)
driver = webdriver.Firefox(firefox_profile=profile)

Note that if it's possible via some other language bindings then I'm sure it is via python. So feel free to post non-python solutions and I'll translate once I have the hint!

1 Answers
Related