Estou tentando marcar um checkbox via webbrowser, mas não estou conseguindo marcar.
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");
}
}
}
}
Quando verifico o html
da pagina ele esta setando o label checked="true
HtmlElement
errado apenas