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

后端 未结 8 1510
囚心锁ツ
囚心锁ツ 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:37

    I found the accepted solution didn't work, however this slight change did:

    from selenium import webdriver
    
    chrome_options = webdriver.ChromeOptions()
    prefs = {'download.default_directory' : '/path/to/dir'}
    chrome_options.add_experimental_option('prefs', prefs)
    driver = webdriver.Chrome(chrome_options=chrome_options)
    

提交回复
热议问题