Taking information from an HTML page in C# (Webbrowser)

Asked

Viewed 238 times

1

I’m trying to get information from a website and I’m having a hard time getting the right result.

Basically, I need to get the software version on the site: https://www.computerbase.de/downloads/systemtools/all-in-one-runtimes/

All I care about is the line:

<span class="download-version__version">2.4.6 <span class="german-flag">Deutsch</span></span>

I want to get the data from the "download-version__version" class and I’m not getting it...

Follows the code:

var htmlElement = webBrowser.Document.GetElementsByTagName("span");

foreach(HtmlElement htmlEl in htmlElement)
{
    String nameStr = htmlEl.GetAttribute("class");
    if (nameStr != null && nameStr.Length != 0)
    {
        String contentStr = htmlEl.GetAttribute("download-version__version");
        MessageBox.Show(contentStr);
    }

There is a functional method?

  • What is it about? Windowsforms, a console application, wpf, web? And does it need to be with Webbrowser? it is a little slow and heavy for a simple task as esssa

  • Leandro, it’s Windowsforms and I don’t create Webbrowser in the form, I create Webbrowser in the same code and I just redirect him to the page I reported. I can get a lot of information, but not the information of that class that is in the code... Webbrowser is not required. Any other alternative is welcome.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.