Skip to content Skip to sidebar Skip to footer

Parsing Radio Button Name Only Bringing Up One Value

I have written some code to parse the name from some radio buttons.
<input> element but <span> element. And <span> is not child of <input>. So assuming that it isn't typo or paste error, you can select <span> directly without selecting <input> element first :

HtmlNodeCollection link = doc.DocumentNode.SelectNodes("//*[@id='First']/span");
if (link != null)
{
    foreach (HtmlNode item in link)
    {
        string name = item.InnerText;
        Console.WriteLine(name);
    }
    Console.ReadLine();
}

Post a Comment for "Parsing Radio Button Name Only Bringing Up One Value"