【发布时间】:2019-04-15 13:47:45
【问题描述】:
我看到了一些示例,这些示例解释了如何通过 VBA 在 Internet Explorer 中单击按钮。但是,我需要使用的网站无法正常工作。
*它没有“id”。我看到了 querySelector 函数,但它并没有很好地工作。
网站:http://www2.bmf.com.br/pages/portal/bmfbovespa/boletim1/TxRef1.asp
Sub Download()
Dim user, password As Variant
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "http://www2.bmf.com.br/pages/portal/bmfbovespa/boletim1/TxRef1.asp"
IE.Visible = True
While IE.Busy
DoEvents
Wend
Application.Wait (Now + TimeValue("00:00:02"))
'Preencher o Login e Senha
IE.Document.querySelector("img[src='images/toolbar/b_edit.gif']").Click
End Sub
【问题讨论】:
-
上面提到的按钮在页面顶部和右侧。名称:“exportar para o excel”
-
@Vinicius,你的问题解决了吗?我测试了 QHarr 建议的解决方案,看起来他的代码运行良好,可以解决您的问题。我建议您测试他的代码并将他的建议标记为该线程的可接受答案。它可以在未来帮助其他社区成员解决类似的问题。如果您有任何其他问题,可以让我们知道。感谢您的理解。 +1 为 QHarr
标签: excel vba internet-explorer web-scraping