如何使用selenium下载chrome中的.msi文件

2024-04-26 11:00:21 发布

您现在位置:Python中文网/ 问答频道 /正文

download error

如何使用selenium和python避免这个问题


Tags: selenium
1条回答
网友
1楼 · 发布于 2024-04-26 11:00:21

{不要求下载}应设置}

from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'application/octet-stream')
profile.set_preference("browser.safebrowsing.enabled", 'false')
driver = webdriver.Firefox(profile)
driver.get("http://yourpage.com")

"application/octet-stream"是文件类型,如果不知道文件类型,请选中MIME types

使用chrome,您应该能够使用:

^{pr2}$

另请查看this answer以获取更多信息

相关问题 更多 >