1. Set some download parameters first:
#To set the parameters, the parameters can be viewed by entering about:config in the browser address bar.#Set to 0 for download to browser default download path, set to 2 to save to the specified directory Fp.set_preference ("Browser.download.folderList", 2)#Whether the display starts, (the individual experiment, whether set to True or false, does not show start, direct download) fp.set_preference ("browser.download.manager.showwhenstarting ",false) # download to the specified directory Fp.set_preference ( Span style= "COLOR: #800000" > "browser.download.dir", Span style= "COLOR: #800000" > "c:\\temp" " # Don't ask for the download path The following parameter is the value of the content-type of the page to download fp.set_preference ( " Browser.helperapps.neverask.savetodisk" application/octet-stream ")
2, open the browser, enter the URL, click the Download button, as follows the code example
Python+selenium File Download