I am trying to use Selenium to download some files (.3ds). I am using FireFox (v94.0.1 64-bit), but am fine to use another browser if it will help. I am using MacOS.
The issue is that when I click a download link, a dialog is shown:
I don't want any user input; this should all be automatic.
I need to get Selenium to click save file
, check do this automatically...
, and then click OK
.
I have tried the solutions in this post, but the dialog is always shown:
profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.panel.shown", False)
profile.set_preference("browser.helperApps.neverAsk.openFile","application/octet-stream")
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/msword, application/csv, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream");
profile.set_preference("browser.download.manager.showWhenStarting", False);
profile.set_preference("browser.download.manager.alertOnEXEOpen", False);
profile.set_preference("browser.download.manager.focusWhenStarting", False);
profile.set_preference("browser.download.folderList", 2);
profile.set_preference("browser.download.useDownloadDir", True);
profile.set_preference("browser.helperApps.alwaysAsk.force", False);
profile.set_preference("browser.download.manager.alertOnEXEOpen", False);
profile.set_preference("browser.download.manager.closeWhenDone", True);
profile.set_preference("browser.download.manager.showAlertOnComplete", False);
profile.set_preference("browser.download.manager.useWindow", False);
profile.set_preference("services.sync.prefs.sync.browser.download.manager.showWhenStarting", False);
profile.set_preference("browser.download.dir","/Users/myusername/Downloads")
browser = webdriver.Firefox(firefox_profile=profile,executable_path=GeckoDriverManager().install())
browser.maximize_window()
How can I solve this?