I'm having issues with accessing a button with a span tag because it is nested within multiple tags. Here is a screenshot of the code with the highlighted portion that I'm trying to click on. [1]: https://i.stack.imgur.com/yaPIk.jpg "HTML code"
I've already tried getting all of the spans element by using elementcollection but it still cannot access the span element that I need.
Dim HTMLspans As MSHTML.IHTMLElementCollection
Set HTMLspans = HTMLDoc.getElementsByTagName("span")
For Each HTMLspan In HTMLspans
Debug.Print HTMLspan.getAttribute("id")
This code will show me some span elements but not all. I also tried using nested for loops to see if I can access it like this but it still doesn't work.
For Each HTMLtable In HTMLtables.getElementsByTagName("table")
For Each HTMLtbody In HTMLtable.getElementsByTagName("tbody")
For Each HTMLtr In HTMLtbody.getElementsByTagName("tr")
For Each HTMLtd In HTMLtr.getElementsByTagName("td")
For Each HTMLspan In HTMLtd.getElementsByTagName("span")
Debug.Print HTMLspan.getAttribute("id")
Next HTMLspan
Next HTMLtd
Next HTMLtr
Next HTMLtbody
Next HTMLtable
This returns some span element but it doesn't show the one that I need.
With the right code, I expect to access the span tag with the id="revit_form_ComboButton_0_label"
But I can't access it. Could this code be the one that's causing issues?
<!--Portlet-Outlined Start-->
I cannot access any tags under this code and it's unfortunate that the website I'm using is not public.