Webbrowser sub-elements RRS feed

  • Question

  • Hi! How can I check an element's number (the highlighted) on a webpage in webbrowser?
    the html code something like this: 

    <td id="all">
    <font color="green">
    <span data-c="4"> 4 A</span>

    <td id="final">
    <font color="green">
    <span data-c="0">0 A</span>

    <td id="n">
    <font color="green">
    <span data-c="45">45 A</span>

    I want to check that the highlighted number is greater than zero. 

    Saturday, August 18, 2018 11:10 AM

All replies

  • Hello,

    High level if the span elements had id then you can target the specific element but they don't so you would need to get ready to use a library known as HtmlAgilityPack which usually takes time to learn. 

    Walk the DOM (Document Object Model) for the table, find the td element with the id of final, target the span and get it's value. No I don't have a code sample.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Saturday, August 18, 2018 12:15 PM