作者:奔跑的饼干的饼干桶_698 | 来源:互联网 | 2023-10-15 14:11
代码如下
1 2 3 4 5 6 7 8 9
| #设置浏览器
chrome_optiOns= webdriver.ChromeOptions()
# chrome_options.add_argument("--headless")
chrome_options.add_argument('log-level=3')
prefs = {"download.default_directory": 'F:\a\python\selenium',
"profile.managed_default_content_settings.images":2,
"download.prompt_for_download": False}
chrome_options.add_experimental_option("prefs",prefs)
driver = webdriver.Chrome(chrome_optiOns=chrome_options) |
它始终下载到c盘的下载目录,就算手动更改了默认下载路径,它依然无效