Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set download directory and disable download or open popup using Firefox #19

Closed
pxfurkanenes opened this issue Apr 22, 2020 · 3 comments

Comments

@pxfurkanenes
Copy link

Helium really does a great job simplifying selenium interface and I like using it. However, I couln't manage to set a profile for Firefox in order to change download directory and disable download popup. I think these were essential features for me while using selenium. Are you planning to add this kind of settings to start_firefox and start_chrome just like headless=True option?

@mherrmann
Copy link
Owner

Thank you for the kind words. I'm happy to hear you like Helium.

Regarding your question: Helium lets you supply ChromeOptions to start_chrome since the last release. Maybe something similar could be added for Firefox?

Either way, I won't have time to implement this. But I will be happy to merge a PR that does it.

@ftnext
Copy link
Contributor

ftnext commented May 4, 2020

I implemented this feature. See PR #22 .

Usage

from selenium.webdriver import FirefoxOptions

options = FirefoxOptions()
options.set_preference("browser.download.useDownloadDir", True)
options.set_preference("browser.download.folderList", 2)
options.set_preference("browser.download.dir", "path/to/download/directory")
options.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/csv")  # specify content-type
start_firefox("connpass.com/login", options=options)

ref: https://stackoverflow.com/a/36309735

@mherrmann
Copy link
Owner

Thank you again @ftnext. I've released this on PyPI as version 3.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants