Download a file to a specific path using Selenium WebDriver
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to download a file to a given location on a non-local machine. This is the normal flow of the web browser for which I would do this: Go to website Click button to download file (it is a form that generates the file, it is not a download link) The website prompts an alert window "Do you want to download this file?", etc. I want to be able to bypass the file and do something like: >>> path_to_download_path = PATH >>> button = driver.find_element_by_css("...") >>> button.click() --> And the file is automatically downloaded to my PATH (or