简体   繁体   中英

C# Parsing hidden fields with the HTML Agility Pack

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?

from memory, something like:

var value = docroot.SelectSingleNode("//input[@type='hidden' and @name='foo']")
                .Attributes["value"].Value;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM