I am having trouble finding a link in an html page. As a way find the link, I created some code which dumps all outerhtml or innerhtml elements based on which you choose to send to the sub. It works fine, but for some reason will not reflect the link I need. Therefore, I cannot see the element I want to click.
The web page has a column to the left. My tag dump sub doesn't seem to go beyond that to get the main page tags.
Tried dozens of ways to capture the elements, but had no success.
On the webpage documentcompleted event, run this code:
For Each link As HtmlElement In links
DumpTags(link.OuterHtml.ToString)
'DumpTags(link.innerHtml.ToString)
If link.InnerHtml.IndexOf("Correspondence") <> -1 Then
link.InvokeMember("Click")
End If
Next
Private Sub DumpTags(link As String) 'write a text file with all htmlelements
Dim strwriter As IO.StreamWriter
strwriter = New IO.StreamWriter("C:\temp\tags.txt", True)
strwriter.WriteLine(link)
strwriter.Close()
End Sub
Expected behavior: The code works but it doesn't seem to go deep enough. I want to get all html links including (in this case) a link with "Correspondence" as a tag name.