Reputation: 41
I am trying to make a loop to find every HtmlElement from the webpage which, I am currently on in my web browser control in C#.
I've tried:
var elements = webbrowser1.Document.GetElementsByTagName("textarea");
foreach (HtmlElement el in elements) {
MessageBox.Show(el);
}
Upvotes: 2
Views: 10618
Reputation: 8759
I'll post this as an answer, so that it's easy to find.
All document elements are under webBrowser1.Document.All
.
You can iterate over them as such:
foreach (HtmlElement element in webBrowser1.Document.All)
{
MessageBox.Show(element.Id);
}
Upvotes: 8