I am creating a small test application in which i am trying to fetch the all the hyperlink's details(Anchor Text and url) on the web page. What i have done till now is that i create webbrowser component loaded the page and fetch all <a> tags. I also know that how to print the value of "href" attribute. I am having trouble to get the text on which link is applied (i.e anchor text).
Here is the code which i have done till now.
Uri page = new Uri("http://www.yahoo.com"); webBrowser1.Url = page; HtmlElementCollection aTags = webBrowser1.Document.GetElementsByTagName("a"); textBox1.Text= aTags.GetAttribute("href");
now the textbox1 contains the address of the 1st link. but how to get the anchor text ??