3

I am trying to download some files using Selenium and Python in Chrome, but when I download a file with .msg extension Chrome asks for permission to download the file. I want to disable it.

I tried the below code

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_experimental_option("prefs", {
  "download.default_directory": r"C:\Users\downloads",
  "download.prompt_for_download": False,
  "download.directory_upgrade": True,
  "safebrowsing.enabled": False
})
driver = webdriver.Chrome(chrome_options=chrome_options)

I also tried changing the FileTypePolicies -> download_file_types.pb file, but it didn't work.

0m3r
  • 12,286
  • 15
  • 35
  • 71
Ajinkya
  • 201
  • 4
  • 11

0 Answers0