I am trying to scrape data from a website with the following HTML code
<a href='https://somesite.com/nation/id=344'>Vee Veetis <img src='https://somesite.com/img/flags/albania.jpg' class='tinyflag'></a><br />FireBird </td>
I have the following VBA
With IE.document
Set elems = .getElementsByTagName("a")
For Each e In elems
If e Like "https://somesite.com/record/id=*" Then
Sheets("Members").Range("A" & i).Value = e
Sheets("Members").Range("B" & i).Value = e.innerText ' doesnt work, returns "view" - desire 'Vee Veetis'
Sheets("Members").Range("C" & i).Value = e.outerText ' doesnt work, returns "view" - desire 'Firebird'
i = i + 1
Exit For ' remove this to scrape remaning items once working
End If
Next e
End With
I am able to scrape the actual link without problem, but I am struggling to find how I can reference the Text that contains the link "Vee Veetis" and the corresponding text 'Firebird' that is directly after the link. Does anybody have guidance on how these are related and can be efficiently scraped?