【发布时间】:2010-11-26 19:03:06
【问题描述】:
我正在尝试使用 IE 使用 Python 下载文件:
from win32com.client import DispatchWithEvents
class EventHandler(object):
def OnDownloadBegin(self):
pass
ie = DispatchWithEvents("InternetExplorer.Application", EventHandler)
ie.Visible = 0
ie.Navigate('http://website/file.xml')
在此之后,我得到一个窗口,询问用户将文件保存在哪里。如何从 python 中自动保存这个文件?
我需要使用一些浏览器,而不是 urllib 或机械化,因为在下载文件之前我需要与一些 ajax 功能进行交互。
【问题讨论】:
-
我相信这是用户在偏好中定义的行为。
标签: python internet-explorer com