这是页面的html代码:
<div class="form-group">
<label for="TextInput"><font color="#7f2b1b">Account</font></label>
<input name="Username" class="form-control" placeholder="Enter your Account ID." required="" type="text">
</div>
这是我尝试用C#做的事情:
foreach (HtmlElement o in webBrowser1.Document.GetElementsByTagName("class"))
{
HtmlElement yourElement;
if (o.GetAttribute("name") == "Username")
{
yourElement = o;
yourElement.SetAttribute("value", "FillingText");
break;
}
}