I'm unable to test file download with Selenium (python), after Chrome update to the version '122.0.6261.70'.
Previously running Chrome with the '--allow-running-insecure-content' arg did a trick. The same is suggested over the net. On some sites one additional arg is suggested: '--disable-web-security'.
But both change nothing for me (the warning keeps appearing).
Does anybody know if something has been changed between the 121 and 122 versions?
Is there some arg or pref that I'm missing?
Warning image for the reference:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
for arg in ["--allow-running-insecure-content", "--disable-web-security"]:
options.add_argument(arg)
driver = webdriver.Chrome(options=options)
Okay, so found two solutions:
--unsafely-treat-insecure-origin-as-secure=*
--disable-features=InsecureDownloadWarnings
--
This is what worked for me:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--window-size=1920,1080")
chrome_options.add_argument("--allow-running-insecure-content") # Allow insecure content
chrome_options.add_argument("--unsafely-treat-insecure-origin-as-secure=http://example.com") # Replace example.com with your site's domain
chrome_options.add_experimental_option("prefs", {
"download.default_directory": download_path,
"download.prompt_for_download": False,
"download.directory_upgrade": True,
"safebrowsing.enabled": True
})
driver = webdriver.Chrome(options=chrome_options)