I'm trying to mark a checkbox via webbrowser, but I can not dial.
HtmlElementCollection theElementCollection = default(HtmlElementCollection);
theElementCollection = doc.GetElementsByTagName("div");
foreach (HtmlElement curElement in theElementCollection)
{
if (curElement.GetAttribute("className").ToString() == "checkbox")
{
foreach (var item in curElement.All)
{
if (((HtmlElement)item).InnerText == null)
continue;
if (((HtmlElement)item).InnerText.Contains(" Windows 10") || ((HtmlElement)item).InnerText.Contains(" Windows XP")
|| ((HtmlElement)item).InnerText.Contains(" MS-DOS"))
{
((HtmlElement)item).SetAttribute("checked", "true");
}
}
}
if (curElement.GetAttribute("className").ToString() == "radio")
{
foreach (var item in curElement.All)
{
if (((HtmlElement)item).InnerText == null)
continue;
if (((HtmlElement)item).InnerText.Contains("Masculino"))
{
((HtmlElement)item).SetAttribute("checked", "true");
}
}
}
}
WhenIcheckthehtml
ofthepageheissettinglabelchecked="true