Hi, I need parse a select value in html file. I have this html file:
<html>
<head></head>
<body>
<select id="region" name="region">
<option value="0" selected>Všetky regiony</option>
<optgroup>Banskobystrický kraj</optgroup>
<option value="k_1">Banskobystrický kraj</option>
<option value="1">Banská Bystrica</option>
<option value="3">Banská Štiavnica</option>
<option value="18">Brezno</option>
<option value="22">Detva</option>
<option value="58">Dudince</option>
</select>
</body>
</html>
I need get select option value and also text value in dictionary. I load this file in webBrowser component a try get select tag by ID "region".
webBrowser1.Url = new Uri("file://\\C:\\1.html");
if (webBrowser1.Document != null)
{
HtmlElement elems = webBrowser1.Document.GetElementById("region");
}
But object elems is null, I don’t why. Any advance?
EDIT: Problem was resolved with Html Agillity Pack. Thank for everybody. I was stupid, I had rather listen to your advice with Html Agillity Pack first.