Issue
I am trying to download the file automatically from system file download dialog by setting preference in firefox profile in my python selenium code , but my code is not working.
Browser : Firefox 72.0 Selenium Version : 3.14 OS : linux Ubuntu Filetype to download: *.enc (encrypted file type) Path of firefox in linux : /usr/bin/firefox
Code :
profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList", 2)
profile.set_preference("browser.download.manager.showWhenStarting", False)
profile.set_preference("browser.download.dir", "/home/user/Downloads/tests")
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/x-uuencoded,application/octet-stream")
self.driver = webdriver.Firefox(firefox_profile=profile)
Solution
The correct MIME type for .enc
is "text/x-uuencoded"
Updated as below in code and it's working :
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "text/x-uuencoded")
Answered By - Sum
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.