-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
I copied over as you have but I am having issues on my end. Downloading files with headed Chrome is fine, but can't get it with Chrome headless. I'm running Chrome 66 on MacOSX, Python 3, Selenium 3.11
#Initial settings
chrome_path = root_dir + "software/chromedriver"
chrome_profile = chrome_webdriver.Options()
profile = {
'download.default_directory' : data_dir,
"download.prompt_for_download": False,
"download.directory_upgrade": True,
'safebrowsing.enabled': False,
'safebrowsing.disable_download_protection': True
}
chrome_profile.add_experimental_option('prefs', profile)
chrome_profile.add_argument("--headless")
And then...
#Once browser is launched, execute following command to "enable" headless downloading
browser.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command')
params = {'cmd': 'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': data_dir}}
command_result = browser.execute("send_command", params)
print("response from browser:")
for key in command_result:
print("result:" + key + ":" + str(command_result[key]))
Program runs without errors, but cannot download as I was able to in headed mode. Anything different from Mac to Windows?
Metadata
Metadata
Assignees
Labels
No labels