0
我已經應用了所有的配置以防止下載窗口彈出,但仍然出現,即使在FF中的Option中,配置設置爲「save file to」。它使我瘋了,請大家幫忙:Python中的Selenium - 下載對話框仍然打開
profile = webdriver.firefox.firefox_profile.FirefoxProfile()
profile.set_preference("browser.download.folderList", 2) # custom location
profile.set_preference("browser.download.manager.showWhenStarting", False)
profile.set_preference("browser.download.dir", path)
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', ('text/tsv'))
profile.set_preference("webdriver_enable_native_events", False)
profile.set_preference("browser.download.manager.scanWhenDone",False)
profile.set_preference("browser.download.manager.useWindow",False)
profile.set_preference("browser.helperApps.alwaysAsk.force",False)
#profile.set_preference('browser.download.dir', os.getcwd())
'text/plain, application/vnd.ms-excel, text/tsv, text/comma-separated-values, application/octet-stream, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)
driver.implicitly_wait(60)
base_url ="the base url"
爲什麼我得到-1在這個問題上? –