Is it possible to disable file download in chrome using selenium

只谈情不闲聊 提交于 2020-01-13 10:40:19

问题


On visiting some pages using ChromeDriver and Selenium, downloading of a particular file is happening automatically. Because of the file download, the code is not proceeding further. Is it possible to disable downloading of file using any ChromeOptions or preferences that can be set while creating ChromeDriver.

Tried the following ChromeOptions, but none helped.

prefs.put("download.default_directory", "NUL");
prefs.put("download.prompt_for_download", false);
prefs.put("profile.default_content_setting_values.automatic_downloads", 0);

来源:https://stackoverflow.com/questions/44144502/is-it-possible-to-disable-file-download-in-chrome-using-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!