document.getElementsByTagName("tr").length returns zero when I execute a VBA script to find the number of tr elements on a specific web page
Sub AutomaticMode()
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "https://www.example.com/"
Do While IE.readyState < 4
Application.StatusBar = "DOM Loading ..."
Loop
Set username_field = IE.document.getElementByID("username")
username_field.Value = "username"
Set password_field = IE.document.getElementByID("password")
password_field.Value = "password"
SendKeys "{Tab}{Enter}"
Do While IE.readyState < 4
Application.StatusBar = "DOM Loading ..."
Loop
Dim trList As IHTMLElementCollection
Set trList = IE.document.getElementsByTagName("tr")
MsgBox (trList.Length)
End Sub
trList.Count?Set trList = ...line and wait a little while before continuing execution, does that change the outcome ?trListlike this instead:Dim trList As Object, then try using.count