Getting "Class" attribute from a web browser document

Posts 1–4 of 4 · Page 1 of 1
Getting "Class" attribute from a web browser document
Example:
Code:
<td class="RANDOM"><strong>THE TEXT I WANT</strong></td>
I need to get the class

I know you can get the id via
Code:
WebBrowser1.Document.GetElementById
but I need to get the class. So please help. Thanks ahead of time
Code:
Dim elements As IEnumerable(Of HtmlElement) = WebBrowser1.Document.GetElementsByTagName("td").Cast(Of HtmlElement)().Where(Function(h As HtmlElement) h.GetAttribute("className") = "RANDOM")
'element now contains all the td elements with the class name "random"
done.
Then use the InnerText property on the HtmlElements to get the text in-between.
Thanks both of you.

Got it

you can close this /solved
Posts 1–4 of 4 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?