selenium doesn't set downloaddir in FirefoxProfile

前端 未结 1 891

i want to auto download files and save them in directory, everything is done but firefox stills save files in User download folder e.g. C:\\users\\root\\Downloads

相关标签:
1条回答
  • 2021-02-20 10:25

    There are couple methods to a solution for this problem,

    1. Make sure that the path is valid. Use something like, os.path.exists or os.isfile
    2. When the Firefox launches with the selenium driver, navigate to about:config and check the look up browser.download.dir, to make sure there was a change.
    3. Finally, make sure that profile.set_preference (profile.set_preference("browser.download.folderList",2) has 2 as a second argument, since 0 means to download to the desktop, 1 means to download to the default "Downloads" directory, 2 means to use the directory you specify in "browser.download.dir"
    4. Make sure your path is noted with back slashes '\' not forward slashes '/'
    0 讨论(0)
提交回复
热议问题