Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74020

How i can get span id with HTMLElement and Document in Webbrowser C#?

$
0
0

This is the HTML code

<div class="service sep">
    <span class="name">
        <img class="game-icon" alt="" width="20" height="20" src="static/icons/csgo.jpg"> 
        <a rel="noopener" target="_blank" href="https://steamdb.info/app/730/graphs/">
          CS:GO
        </a> 
        Game Coordinator 
     </span>
     <span class="status good" id="csgo">Normal</span>
</div>

And this is my C# code

foreach (HtmlElement etiqueta in PerlaNegra2.Document.All)
{
 if (etiqueta.GetAttribute("classname").Contains("service sep"))
 {
   if (etiqueta.InnerText.Contains("Normal"))
   {
     lblValveServers.Text = "Operational";
   }
   else
   {
     lblValveServers.Text = "Maintenance";
   }
 }
}

I want to get the "Normal" status but this actually throws me to Maintenance. How can I get it? I'm using HTMLElement and web browser in C#


Viewing all articles
Browse latest Browse all 74020

Trending Articles