How do I read data in-between html tag such as <strong>. For example.
<strong id="food">40</strong>
How do I retrieve the integer 40 from there ? I tried
myBrowser.Document.GetElementById("food").GetAttribute("value");
How do I read data in-between html tag such as <strong>. For example.
<strong id="food">40</strong>
How do I retrieve the integer 40 from there ? I tried
myBrowser.Document.GetElementById("food").GetAttribute("value");
You're looking for the InnerHtml property.
InnerText
[STAThread]
static void Main(string[] args)
{
WebBrowser w = new WebBrowser();
w.Navigate(String.Empty);
HtmlDocument doc = w.Document;
doc.Write("<html><head></head><body><p id=\"food\">40</p></body></html>");
Console.WriteLine(doc.GetElementById("food").InnerText);
Console.ReadKey();
}
I believe you are looking for InnerText.