I have a login form I wanna fill programmatically in C# I have a webbrowser and I did it this way, but it doesn't fill the form.
<div>
<label class="control-label" for="Login">Login</label>
<input class="input-sm form-control" data-val="true" data-val-required="The Login field is required." id="Login" name="Login" type="text" value="">
</div>
<div>
<label class="control-label" for="Password">Password</label>
<input class="input-sm form-control" data-val="true" data-val-required="The Password field is required." id="Password" name="Password" type="password" value="">
</div>
<div>
<input type="submit" class="btn btn-default btn-sm" value="Valider" id="CmdValider">
<input type="button" class="btn btn-default btn-sm" value="Quitter" onclick="javascript:window.close();">
</div>
How I tried to fill them
webBrowser1.Document.GetElementById("Login").SetAttribute("Login", "myLogin");
webBrowser1.Document.GetElementById("Password").SetAttribute("Password", "myPassword");
I'm only able to click on the login button, which works but is useless until I find how to fill the login and password
webBrowser1.Document.GetElementById("CmdValider").InvokeMember("click");
Thanks for your help
For both queries, you should be doing
webBrowser1.Document.GetElementById("elementid").SetAttribute("value", "something");
The only difference is that in SetAttribute I'm passing the first argument as "value" instead of something else.