python可以通过ChromeOptions设置chrome参数,如下载路径等,代码如下(python 3.6.7):

#-*-coding=utf-8-*-

from selenium import webdriver
import time def set_chrome_pref():
chromeOptions = webdriver.ChromeOptions()
prefs = {"download.default_directory":"D:\\"}
chromeOptions.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(chrome_options=chromeOptions)
time.sleep(10)
04-25 11:30