How would I get text from HTML on a website?

This is all I know to get to it but its only the elements;

webBrowserMain.Document.GetElementById("footer").Children

GetElementsByTagName("ptz-footer")

GetElementsByName("ptz_value")

The ptz_value has the text I want to retrieve.

Thanks...

Recommended Answers

All 2 Replies

The GetElementsByName("ptz_value") return a NodeList object (collection of nodes). Traverse that collection and I'm sure you will get "Text".

Can you show an example? Iv'e been playing around with trying to get the text for some time now.

This is all I got.

this.Text = webBrowserMain.Document.GetElementById("ptz_value").InnerText;
                foreach (HtmlElement i in webBrowserMain.Document.GetElementById("footer").Children)
                {
                    
                    i.Document.
                     // MessageBoxEx.Show(i.GetElementsByTagName("ptz-footer").GetElementsByName("ptz_value").ToString());
                    
                }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.