【发布时间】:2021-10-15 12:07:47
【问题描述】:
IE.visible=False时有什么方法可以点击保存按钮吗?
我尝试了这个仅在 ie.visible =True 时有效的选项 Excel VBA to Save As from IE 11 Download Bar
通用示例:
Sub scrape_ex()
Dim oHTML_Element As IHTMLElement
Dim oHTML_Element_signo As IHTMLElement
Dim oBrowser As InternetExplorer
Dim ie As Variant
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = False
ie.navigate "URL"
While ie.readyState <> READYSTATE_COMPLETE And ie.readyState <> READYSTATE_LOADED
DoEvents
Wend
For Each oHTML_Element In ie.document.getElementsByClassName("class")
If oHTML_Element.Title = "my_download" Then
oHTML_Element.Click
Application.Wait (Now + TimeValue("00:00:03"))' Download Bar starts
Exit For
End If
Next
''clicking on Save that work with ie.visible=False ???
编辑:
点击页面中的按钮效果很好,在网页中不是问题。我想在IE下载栏开始时点击“保存”(IE.visible=False,所以我不能使用SendKeys):
【问题讨论】:
标签: vba web-scraping internet-explorer