我正在使用Selenium Webdriver(在Python中)自动下载数千个文件.我想以编程方式设置Chrome的下载文件夹.看完这个,我尝试这样做:
chromepath = '/Users/thiagomarzagao/Desktop/searchcode/chromedriver'
desired_caps = {'prefs': {'download': {'default_directory': '/Users/thiagomarzagao/Desktop/downloaded_files/'}}}
driver = webdriver.Chrome(executable_path = chromepath, desired_capabilities = desired_caps)
Run Code Online (Sandbox Code Playgroud)
不好.下载仍然会转到默认下载文件夹("/ Users/thiagomarzagao/Downloads").
有什么想法吗?
(Python 2.7.5,Selenium 2.2.0,Chromedriver 2.1.210398,Mac OS X 10.6.8)