Downloading a file at a specified location through python and selenium using Chrome driver

后端 未结 8 1507
囚心锁ツ
囚心锁ツ 2020-12-01 02:56

I am trying to automatically download some links through selenium\'s click functionality and I am using a chrome webdriver and python as the programming lan

8条回答
  •  情歌与酒
    2020-12-01 03:27

    Update 2018:

    Its not valid Chrome command line switch, see the source code use hoju answer below to set the Preferences.

    Original:

    You can create a profile for chrome and define the download location for the tests. Here is an example:

    from selenium import webdriver
    
    options = webdriver.ChromeOptions() 
    options.add_argument("download.default_directory=C:/Downloads")
    
    driver = webdriver.Chrome(chrome_options=options)
    

提交回复
热议问题