我想单击HTML Doc中的Anchor标签元素,但是我无法选择,我尝试了各种方法, 我正在发布我使用的VBA代码,请检查并更正我,请参考图像以获取HTML代码。 (突出显示) Sub TestBirst()
Dim i As Integer
Dim objElement As Object
Dim objCollection As Object
'Dim HWNDSrc As Long
Dim tr As Object
Dim td As Object
Dim IE As Object
Dim loginButton As Object
Dim loginButton1 As Object
Dim element As Object
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLTable As MSHTML.HTMLTable
Dim link As HTMLLinkElement
Dim oHTML_Element As IHTMLElement
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "[https://app2102.eu1.birst.com/login.html][1]"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set HTMLDoc = IE.document
IE.document.getElementById("username").Value = "xyz@abc.com"
IE.document.getElementById("password").Value = "abcd$123"
'IE.document.getElementById("admin").Click
Set loginButton = IE.document.getElementsByClassName("btn submit")(0)
loginButton.Click
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
ShowWindow IE.hwnd, 3
Set HTMLDoc = IE.document
Set link = Nothing
For Each oHTML_Element In HTMLDoc.getElementsByTagName("a")
If oHTML_Element.innerText = "02 - BI CoE - Sriram Puvvada Sandbox" Then
oHTML_Element.Click
Do
' Wait till the document is loaded
Loop Until HTMLDoc.readyState = "complete"
Exit For
End If
Next
结束子
任何人都可以检查并让我知道我出了什么问题吗?
这是HTML代码,我需要选择Anchor Tag(突出显示) HTML Code