0

So i am trying to get SCN08_SS_GetCustomer_CAM from this html code.

<tr>
    <td class="line2left bordered">
      <div class="tablelabel typped virtualuser" style="margin-left:00px">SCN08_SS_GetCustomer_CAM</div>
    </td>
    <td class="line2right bordered">875.2</td>
    <td class="line2right bordered">875.2</td>
    <td class="line2right bordered">875.2</td>
    <td class="line2right bordered">1</td>
    <td class="line2right bordered">0</td>
    <td class="line2right bordered">0</td>
    <td class="line2right bordered"></td>
</tr>

I am basically building a desktop application using WPF. Coding in .net c#. In htmlagilitypack there is a way to getelementyid but no getelementbyclass. And in this html code there is no id. Hence i will have to get it by class. So any ideas on how to code this guys?

NASSER
  • 5,900
  • 7
  • 38
  • 57
crossemup
  • 351
  • 1
  • 3
  • 9
  • 1
    You can parse it using `HtmlAgilityPack` as `document.SelectNodes("//div[@class='tablelabel typped virtualuser']")` – NASSER Sep 03 '15 at 04:58
  • To get `HtmlAgilityPack's Documentation`, take a look at [HtmlAgilityPack Documentation](http://stackoverflow.com/questions/32110833/htmlagilitypack-documentation/32111784#32111784) – NASSER Sep 03 '15 at 05:25

1 Answers1

1

Here is a nice and simple application

HtmlDocument htmlDoc = new HtmlDocument();
htmlDoc.Load(@"pathtoyourpage.html");
var result = htmlDoc.DocumentNode.SelectSingleNode("//div[@class='tablelabel typped virtualuser']").InnerText;
Console.WriteLine(result.ToString());

Haven't tested it though

NASSER
  • 5,900
  • 7
  • 38
  • 57
Rohit
  • 10,056
  • 7
  • 50
  • 82