Disable firefox save as dialog-selenium

I use a web scraper with selenium and whenever I try to upload a file, I upload / save the firefox file, however, if the file appears even if I apply profile.set_preference('browser.helperApps.neverAsk.saveToDisk', "application/csv")it still does not work, I tried all .csv related MIME but not It works, can I click the button save asand click okin the dialog box or completely disable it.

+5
source share
2 answers

you have to do two things, first set these three settings as follows (this is in Java, but I think you will be able to translate this into python :-):

profile.setPreference("browser.download.dir", "c:/yourDownloadDir");
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/csv, text/csv");

-, , mime. - .

EDIT:

, MIME- Chrome, Ctrl + Shift + I (Cmd + Alt + Mac OS), "" . - :

Chrome developer tools mime type

+3

, -, (!). MIME CSV, , - application/x-csv - , "" , :)

+1

All Articles