Vitalii Koriakov
Vitalii Koriakov

Reputation: 41

How can I disable file download in Webdriver ChromeProfile

I use Webdriver with Chromedriver on python. I execute pages with automatic file downloading and I need to disable it. What I need to set up in Chrome-driver download profile to disable automatic download?

Upvotes: 1

Views: 2432

Answers (1)

Vitalii Koriakov
Vitalii Koriakov

Reputation: 41

I found next solution: in CromeOption I created a folder that can't be created ("NUL"), so file can't be downloaded, but I can check everything I need on a page.

chrome_profile = webdriver.ChromeOptions()
profile = {"download.default_directory": "NUL", "download.prompt_for_download": False, }
chrome_profile.add_experimental_option("prefs", profile)
self.driver = webdriver.Chrome('chromedriver.exe',chrome_options=chrome_profile)

Upvotes: 3

Related Questions