禁用firefox保存为dialog-selenium [英] Disable firefox save as dialog-selenium
问题描述
profile.set_preference('browser.helperApps.neverAsk.saveToDisk ',application / csv)
,它仍然无法正常工作,我试过每一个.csv相关的MIME,但不起作用,是否可以点击另存为
单选按钮,然后单击对话框上的 ok
或完全禁用它。 你应该做两件事,首先设置这三个偏好如下(这是在Java中,但我想你设法翻译那对python: - ): 其次,您应该确保下载文件具有所需的MIME类型。要做到这一点,你可以使用网络开发工具和检查下载。 编辑: 出来MIME类型打开Chrome,按 Ctrl + Shift + I (Mac OS上的Cmd + Alt +标签并点击你的下载链接。你应该看到这样的内容: I am web scraping with selenium and whenever i try to download i file the firefox download/save as file pops up however, even If i apply you should do two things, first set these three preferences as follows (this is in Java but I guess you manage to translate that to python :-): secondly, you should make sure the download file has the desired mime type. To do that, you can use the web developer tools and inspect the download. EDIT: To find out the MIME type open Chrome, press Ctrl+Shift+I (Cmd+Alt+I on Mac OS) change to the 'Network' tab and click your download link. You should see something like this: 这篇关于禁用firefox保存为dialog-selenium的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
$ p $
profile.setPreference(browser.download.folderList,2);
profile.setPreference(browser.helperApps.neverAsk.saveToDisk,application / csv,text / csv);
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', "application/csv")
, it still doesnt work, I have tried everyt .csv related MIME but doesn't work, is it possible to either click save as
radio button and then click ok
on the dialog or disable it entirely. profile.setPreference("browser.download.dir", "c:/yourDownloadDir");
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/csv, text/csv");