[英]Internet Explorer alternative for VBA automation
I have a VBA code to navigate a webpage, read content, click buttons, fill in text etc... This code uses internet explorer.我有一个 VBA 代码来浏览网页、阅读内容、单击按钮、填写文本等...此代码使用 Internet Explorer。 Below I didn't copy the code but only put the main objects I am using to give you an idea:下面我没有复制代码,只是把我使用的主要对象给你一个想法:
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Dim oHTML_Element As IHTMLElement
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate Url
ie.Visible = True
...
Set oBrowser = ie
oBrowser.Visible = True
...
Set HTMLDoc = oBrowser.document
Set nodeAllDiv = HTMLDoc.getElementsByTagName("p")
Txt = nodeAllDiv.Item(0).innerText
..
HTMLDoc.getElementsByTagName("p").Item(nodeAllDiv.Length - 1).Click
Set listButtons = HTMLDoc.getElementsByTagName("button")
listButtons.Item(0).Click
Set formDivs = HTMLDoc.getElementsByTagName("form")
The issue is that recently the webpage I am navigating is not supported by internet explorer anymore and uses Chrome or Edge, therefore I cannot use this VBA code as it is.问题是最近我正在导航的网页不再受 Internet Explorer 支持,而是使用 Chrome 或 Edge,因此我不能按原样使用这个 VBA 代码。
Is there a way I can reuse what I have written so far (reusing the same objects etc... )?有没有办法可以重用我迄今为止写的东西(重用相同的对象等......)? If possible without migrating to another framework/language如果可能,无需迁移到另一种框架/语言
Thanks谢谢
Seleniumbasic
is a web automation package for the VBA environment that you might want to take a look at. Seleniumbasic
是 VBA 环境的 web 自动化 package,您可能想看看。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.