On Nov 13, 7:45*am, BobRoyAce <b...@omegasoftwareinc.comwrote:
There is a web page that has a bunch of links on it (i.e. "<A
HREF=..."). I am trying to automate clicking on one in a WebBrowser
control. However when I execute the following code:
* * Dim oCollection As HtmlElementCollection
* * oCollection = WebBrowser1.Document.GetElementsByTagName("A")
oCollection.Count is ZERO. I am assuming that I'm not using the
correct Tag Name. I also tried "a" and "link" but they also return no
elements.
What is the correct Tag Name to use?
Is there a list of the possible tag names somewhere?
Hi Bob,
Using "A" (anchor) as tag to get links should be correct, as i tried
to navigate "www.google.com", "oCollection.Count" returned 29 items.
However you can try "Webbrowser1.Document.Links.Count" to get same
result.
And if you want to get all the links using
"WebBrowser1.Document.Links", just loop through it using GetAttribute
function by specifying "href" as follows:
For Each item As HtmlElement In WebBrowser1.Document.Links
' Do whatever you want with found links
item.GetAttribute("href")
Next
Hope this help,
Onur Güzel