HTML Agility Pack parsing hidden fields in C#

c# hidden-fields html html-agility-pack parsing

Question

I need to write an application for a friends site which parses hidden fields. I've downloaded the Html Agility Pack library, but I'm kinda confused because there are not really any examples. The HTML field looks like this:

<input type = "hidden" autocomplete="off" value="randomvalue" name="foo">

How would I go about getting the value from this field?

1
4
1/26/2012 4:53:10 PM

Accepted Answer

from memory, something like:

var value = docroot.SelectSingleNode("//input[@type='hidden' and @name='foo']")
                .Attributes["value"].Value;
7
9/27/2010 10:44:59 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow